The "no gc" crowd

Craig Dillabaugh craig.dillabaugh at gmail.com
Wed Oct 9 13:07:37 PDT 2013


On Wednesday, 9 October 2013 at 18:44:16 UTC, dennis luehring 
wrote:
> Am 09.10.2013 16:11, schrieb Dicebot:
>> On Wednesday, 9 October 2013 at 13:57:03 UTC, Sean Kelly wrote:
>>> They aren't opt-out for really any reasonable project though,
>>> because code is reused and those people may want at least the
>>> standard attributes to be set. Personally, the array of
>>> attributes that can be applied to a D function is one of my
>>> biggest pet peeves with the language. It gains me nothing
>>> personally, and adds a lot of extra thought to the process of
>>> writing a function.
>>
>> This is exactly what I was speaking about. It would have been
>> much more easy if stuff was `pure @safe immutable nothrow` by
>> default and one added `dirty @system mutable throw` on per-need
>> basis after getting compiler error. But that is too late to
>> change and this attribute inference may be only reasonable 
>> option.
>>
>
> i wouldn't say that - lets talk about D3 or even D4 - with 
> breaking changes or else the language development will come to 
> a full stop in a few months/years, if something is totaly wrong 
> it needs to be addressed and changed, developers will follow

Would it be possible to specify at the file level (or for a 
section of the file) a set of default attributes, and then 
override those for individual functions if need be?  I am not 
sure what the syntax would look like, but say it would be:

attributes @safe pure nothrow

Then every function has these attributes, unless otherwise 
specified. You could even possibly use more than once to divide 
up you code into sections with common attributes.

attributes @safe pure nothrow

//Everything defined here is @safe pure nothrow

attributes @system

//Everything defined below this invocation is @system by default
//and so forth


More information about the Digitalmars-d mailing list