So what does (inout int = 0) do?
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Fri Apr 15 08:22:07 PDT 2016
On 4/14/16 11:10 PM, Andrei Alexandrescu wrote:
> Consider:
>
> https://github.com/D-Programming-Language/phobos/blob/master/std/range/primitives.d#L152
It works around a limitation of inout that isn't necessary (even though
I thought it was being helpful when I suggested it). That is, functions
without inout parameters cannot declare local inout variables. But this
isn't really necessary, and should be fixed. I will discuss this in my
talk in a few weeks.
Note, the =0 part isn't necessary right now, since it's not called. It's
just used to test if the function can compile.
In short, my opinion on inout is that it has some unnecessary
limitations, which can be removed, and inout will work as mostly
expected. These requirements to work around the limitations will go away.
I expect after reading this thread that the Q&A will be.. interesting.
-Steve
More information about the Digitalmars-d
mailing list