accept @pure @nothrow @return attributes

via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 29 03:18:55 PST 2015


On Wednesday, 28 January 2015 at 19:33:32 UTC, Jonathan Marler 
wrote:
> On Wednesday, 28 January 2015 at 19:29:25 UTC, Daniel Kozak 
> wrote:
>>> 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.
>
> None of those cases would valid.  Non-Keyword attributes 
> without a '@' must be on the right hand side of the function 
> parameters.
>

Then I'm afraid the proposal is pointless :-( The goal AIUI is to 
make the language more consistent. If we can't use the new syntax 
everywhere (and later get rid of the old one), we can't achieve 
that.


More information about the Digitalmars-d mailing list