accept @pure @nothrow @return attributes

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Wed Jan 28 11:29:13 PST 2015


Jonathan Marler via Digitalmars-d píše v St 28. 01. 2015 v 19:13 +0000:
> On Wednesday, 28 January 2015 at 19:04:50 UTC, Andrei 
> Alexandrescu wrote:
> > It may be the case you're using different definitions of the 
> > term "contextual keyword". Far as I can tell you want the 
> > identifier "nogc" be recognized in certain places by the 
> > compiler as special, and otherwise just not be special at all. 
> > That's a contextual keyword. If that's the case you were well 
> > understood by both Walter and myself. I happen to recognize the 
> > merit of contextual keyword in general, but Walter has a 
> > stronger opposition to it. It doesn't seem to me this 
> > particular application is compelling enough to warrant the 
> > precedent. -- Andrei
> 
> Ok now we're getting somewhere.  I guess the next thing I'd like 
> to ask is what is the argument against having a word be a 
> function attribute in one instance and a regular identifier in 
> another?
> 
> I would think the reason would be it could make the grammar 
> ambiguous.  That's why I proposed it only be valid on the right 
> hand side of the function to guarantee it doesn't introduce any 
> ambiguity.  Other then that, I don't see any reason why it's a 
> bad thing.  It doesn't make the syntax more complicated, it 
> doesn't maker it harder to parse, I just don't see why its bad.

Thats not possible:

@safe {
    void some func() // now valid
}

safe:
    void some func() // now valid



safe {
    void some func() // could not be valid
}

safe:
    void some func() // could not be valid


So you need more places where keyword needs to be contextual keyword

And this is a path I am not sure we want to go.




More information about the Digitalmars-d mailing list