Make const, immutable, inout, and shared illegal as function attributes on the left-hand side of a function

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 14 10:25:11 PDT 2014


On Tuesday, 14 October 2014 at 16:11:34 UTC, Daniel Murphy wrote:
> "John Colvin"  wrote in message 
> news:ljjtmnnckwzenvhawawx at forum.dlang.org...
>
>> [2] By easily managed I don't mean sed-able, or even 
>> tooling-fixable. For me it pivots on being able to maintain 
>> one code-base that will compile with multiple compiler 
>> versions. An example where this fails: @nogc, being an 
>> attribute, isn't aliasable, meaning you can't version it out 
>> neatly.
>
> There is nothing stopping you from not supporting @nogc until 
> your oldest supported dmd version has it.

Good point.

It would be nice to be able to take advantage of new features 
though, whilst maintaining backward compatibility. Also, a 3rd 
party project could make @nogc a requirement, meaning I have to 
choose between compatibility with older compilers or with that 
3rd party code. Alias-able attributes would help a lot.

> I agree with your requirement, but this is not a good example 
> of it.  A better example would be requiring nothrow annotations 
> on inline asm blocks, because the old code won't compile with 
> newer dmds and the new code won't compile with older ones.

Yes, that's a more concrete example, thanks.


More information about the Digitalmars-d mailing list