Proposal: Definition of @-attributes

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Thu Jan 28 06:25:30 PST 2010


Don wrote:
> Lars T. Kyllingstad wrote:
>> Currently, there doesn't seem to be any clear definition of which 
>> attributes should be prefixed with @ and which shouldn't.
> 
> [snip]
> 
>> Solution (?):
>> I therefore propose the following definition of @-namespace attributes:
>>
>>     The @-attributes of a function only place compile-time
>>     constraints on the body of that function.
>>
>> Specifically, this means that the @-attributes of a function do not 
>> place constraints on calling code, change the syntax of calling code, 
>> nor change the visibility of the function.
>>
>> The above definition means that the following will be @-attributes:
>>
>>     @safe, @trusted, @unsafe
>>     @nothrow, @pure
> 
> @unsafe places constraints on calling code: it can't be @safe.

I considered that, but I think of it the other way around: It's @safe 
that places the "can't call @unsafe" constraint, and not @unsafe that 
places a "can't be called by @safe" constraint.

But I agree there's a fair bit of arbitrariness in this as well. :)

-Lars



More information about the Digitalmars-d mailing list