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

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Mon May 29 19:12:56 PDT 2017


On Monday, May 29, 2017 21:13:53 Stanislav Blinov via Digitalmars-d wrote:
> 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.

That definition currently there is more precise than the definition on that
page has been historically, but even as it stands, it's not particularly
precise. Assuming a particular interpretation when the spec is not precise,
and the compiler does not implement anything of the sort, is just begging
for trouble when the compiler actually does implement something - which is
precisely why Walter decided that it was too dangerous to let in imply scope
when he actually started implementing scope to do something.

It's quite possible that what some folks assumed scope would do won't run
afoul of Walter's changes, but in many cases, it will, and since what he's
doing with scope involves stuff like making it so that you have to mark
local variables with scope (and not in the way that we've had scoped classes
which are supposed to have been deprecated), what he's doing definitely
doesn't match what scope was originally, even if it follows the basic idea.
But scope has never been well-specified.

- Jonathan M Davis



More information about the Digitalmars-d mailing list