[ ArgumentList ] vs. @( ArgumentList )

Walter Bright newshound2 at digitalmars.com
Wed Nov 7 17:48:14 PST 2012


On 11/7/2012 4:03 PM, Andrei Alexandrescu wrote:
> On 11/7/12 10:24 PM, Walter Bright wrote:
>> On 11/7/2012 11:40 AM, Jonas Drewsen wrote:
>>> I we were to allow for @foobar style UDA then "safe" would have to be
>>> a reserved
>>> keyword somehow. Otherwise I do not know what this would mean:
>>>
>>> struct safe { }
>>> @safe void foobar() { }
>>
>> Yes, I agree this is a significant problem.
>>
>
> I think it's solvable. The basic approach would be to plop types "safe",
> "nothrow" etc. in object.di and then let them just behave like all other arguments.

Consider that if we do that, then someone will need to disambiguate with:

    @object.safe

which is ambiguous:

    @a.b .c x = 3;

or is it:

    @a .b.c x = 3;

?

Another problem is it pushes off recognition of @safe from the parser to the 
semantic analyzer. This has unknown forward reference complications.


More information about the Digitalmars-d mailing list