Should out/ref parameters require the caller to specify out/ref like in C#?
via Digitalmars-d
digitalmars-d at puremagic.com
Tue May 30 02:48:09 PDT 2017
On Tuesday, 30 May 2017 at 06:13:39 UTC, Stanislav Blinov wrote:
> On Tuesday, 30 May 2017 at 02:12:56 UTC, Jonathan M Davis wrote:
>
>> That definition currently there is more precise than the
>> definition on that page has been historically...
>
> Apparently, it is not. Do you have a reference to Walter's
> change regarding `in` becoming just `const`? Because a change
> like that should get reflected in the spec, otherwise we might
> just continue to ignore said spec and expect our grievances to
> be "gracefully" resolved later. What I mean is I'd rather
> see/make the change reflected there...
Unfortunately, `in` was never implemented as `scope const`. I
think it was only when Walter started working actively on scope
that he found out that it's too late to change this -
https://github.com/dlang/dmd/pull/5898. Here are some more
references:
https://github.com/dlang/druntime/pull/1740
https://github.com/dlang/druntime/pull/1749
Going forward, I think it would be best for the language if `in`
would work as Q. Schroll described here:
http://forum.dlang.org/post/medovwjuykzpstnwbfyy@forum.dlang.org.
This can also nicely fix the the problems with rvalues (with auto
ref you may end with up to 2^N template instantiations where N is
the number of parameters and 2 is because you get one by value
and one by ref instance; doesn't play nice with delegates etc).
See also https://github.com/dlang/dmd/pull/4717.
More information about the Digitalmars-d
mailing list