[ ArgumentList ] vs. @( ArgumentList )
Sönke Ludwig
sludwig at outerproduct.org
Thu Nov 8 00:48:50 PST 2012
Am 08.11.2012 02:48, schrieb Walter Bright:
> 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.
In that case $(object.safe) would be required - the shortcut then only
works for simple identifiers and would error out going with the second
option ("object is not an attribute" or something).
Templates basically have the same ambiguity: A!x.y.z
More information about the Digitalmars-d
mailing list