Static opCall and class instantiation

Rémy Mouëza Rémy_member at pathlink.com
Mon May 22 12:28:54 PDT 2006


In article <e4su89$j7n$1 at digitaldaemon.com>, Ben Hinkle says...
>> SomeClass  sc2();    // reference assigned to GC-allocated instance
>
>would this open up the C++ can-o'-worms that makes sc2 parse as a function 
>delcaration instead of a constructor call? 

Hello Ben. Seems you had disappeared from the forum for a while. How are you ? 

I've tried several times to parse C++ or subsets of it and it appeared that this
kind of syntax is awful to parse. I didn't pay intention to it while reading the
post (maybe because it was quite late in the night). I think this should not be
allowed in D: it would make the grammar ambiguous and therefore would not keep
the language "spirit". 
Otherwise, the allocation "Someclass sc = Someclass ();" is an interesting
suggestion. It could allow very concise code with auto type inference, like:
auto sc = Someclass ();





More information about the Digitalmars-d mailing list