Why the @ in @safe? & UDAs

Benjamin Thaut code at benjamin-thaut.de
Wed Nov 6 22:07:44 PST 2013


Am 07.11.2013 05:45, schrieb Jonathan M Davis:
> On Wednesday, November 06, 2013 22:11:02 Shammah Chancellor wrote:
>> On 2013-11-07 02:04:36 +0000, Adam D. Ruppe said:
>>> On Thursday, 7 November 2013 at 00:13:49 UTC, Shammah Chancellor wrote:
>>>> My understanding is that @ attributes were for used-defined behavior
>>>> only.
>>>
>>> It is all a historical thing... at first, all new things were done as
>>> keywords. Then around the time @safe came around, they were changing
>>> their minds and new things became @keywords. Then, some time after
>>> that, UDAs came around and used the @ syntax.
>>>
>>> But the reason it is pure and @safe instead of @pure @safe or pure and
>>> safe is just historical accident - they were introduced in that
>>> particular phase, and now the worry is changing it will annoyingly
>>> break too much code for very little real benefit.
>>
>> There's an easy solution to that.   Put warnings on pure, nothrow, and
>> immutable ( in the function tag context) and add @pure, @nothrow,
>> @immutable etc.  Fix it going forward and eventually remove it.
>
> And gain what? You force everyone to change their code for essentially zero
> benefit.
>
> - Jonathan M Davis
>

What about gaining consitency? That was something D1 was really strong 
in, but D2 lost.


More information about the Digitalmars-d mailing list