shouting versus dotting

Benji Smith dlanguage at benjismith.net
Tue Oct 7 07:07:58 PDT 2008


KennyTM~ wrote:
> Benji Smith wrote:
>> Jarrett Billingsley wrote:
>>> On Sun, Oct 5, 2008 at 8:57 PM, Chris R. Miller
>>> <lordsauronthegreat at gmail.com> wrote:
>>>> The !() syntax seems to serve only as a heads up that it's a template.
>>>> Otherwise (as far as I can tell) a simple foo(int)(bar, baaz) would 
>>>> work
>>>> just as well as foo!(int)(bar, baaz).
>>>>
>>>
>>> Unambiguous grammar, you fail it.
>>>
>>> foo(bar)(baz); // template instantiation or a chained call?
>>>
>>> This _can_ be _made_ to work, but it would mean that the parse tree
>>> would be dependent upon semantic analysis, and that just makes things
>>> slow and awful.  I.e. C++.
>>
>> I'd be happy to get rid of OpCall, which I've always found confusing 
>> and pointless.
>>
>> --benji
> 
> That's going to break a lot of struct constructors using static opCalls.

Only because structs should have had constructors from the start. Using 
opCall was always a hack around the lack of constructors on structs.

opCall is a source of numerous language ambiguities that make other 
features more difficult to implement. For example, template 
instantiation could be done with bare parentheses ("Template(args)" 
instead of "Template!(args)" or "Template{args}") if opCall was eliminated.

--benji



More information about the Digitalmars-d mailing list