http://wiki.dlang.org/DIP25

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Dec 29 13:29:21 PST 2014


On 12/29/14 3:42 PM, Dicebot wrote:
> On Monday, 29 December 2014 at 20:20:45 UTC, Steven Schveighoffer wrote:
>> But this precludes doing anything with a mutable t inside foo, since
>> inout means "const within the function".
>
> Hm, yes, this is indeed quite the problem. I have totally forgot that
> compiler has no means of figuring out which invocation of inout is
> currently used.
>
> But something very similar feels necessary to me. There is constness,
> lifetime, purity - inventing new dedicated keyword for each case does
> not feel like scaling approach. Especially when existing one is named so
> generic.

My original inkling was to name it scoped const or sconst, since that's 
what the proposal was originally named. The idea to use inout was 
because of the allergic reaction all the maintainers had at the time to 
adding any new keywords -- inout was fully superseded by ref, and 
technically "available" without introducing any new keywords. I almost 
wish we had never named it that, but I was too happy to have the feature 
at the time.

I think it wouldn't be a bad idea to investigate a new way to express 
attributes, but I think no matter what we do, we need to rein in the 
explosion of attributes that needs to be put on every function.

-Steve


More information about the Digitalmars-d mailing list