Should out/ref parameters require the caller to specify out/ref like in C#?

Stanislav Blinov via Digitalmars-d digitalmars-d at puremagic.com
Mon May 29 14:13:53 PDT 2017


On Monday, 29 May 2017 at 20:31:18 UTC, Jonathan M Davis wrote:
> On Monday, May 29, 2017 20:00:12 Stanislav Blinov via 
> Digitalmars-d wrote:
>> On Monday, 29 May 2017 at 19:14:54 UTC, Jonathan M Davis wrote:
>> > On Monday, May 29, 2017 17:19:27 Stanislav Blinov via
>> >
>> > Digitalmars-d wrote:
>> >> `in` is `const scope`
>> >
>> > Walter recently changed is that in is now just const, 
>> > because scope was not properly implemented previously, and 
>> > folks were using in all over the place, so the odds of code 
>> > breaking when scope was properly implemented were high.
>> >
>> > - Jonathan M Davis
>>
>> Huh, I missed that... peculiar change. :\ So now it would 
>> break for people who did use `in` properly?
>
> Since scope was never properly defined for anything other than 
> delegates, it's questionable that _anyone_ who used it used it 
> properly.

Errm... It was always *defined* 
(https://dlang.org/spec/function.html#parameters). The fact that 
it wasn't implemented for anything but delegates is another issue 
entirely.
Changing spec to please those who didn't care to follow it in the 
first place just seems weird to me.

> But regardless, nothing will break because of scope-related 
> stuff unless you use the -dip1000 switch, which would then 
> require scope in a number of places that it wasn't before 
> (including on local variables in a number of cases IIRC), 
> making it so that even if in had stayed const scope, pretty 
> much regardless of how you used it, code would break (which is 
> going to make life fun when when we finally transition from dip 
> 1000 to being optional to being the normal behavior).

With that, I see no problem. Yes, enabling dip1000 behavior would 
cause some breakage, that's the point of having it as a switch in 
the first place.


More information about the Digitalmars-d mailing list