Static opCall and class instantiation
Kirk McDonald
kirklin.mcdonald at gmail.com
Mon May 22 12:39:35 PDT 2006
Rémy Mouëza wrote:
> 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?
[snip]
> Otherwise, the allocation "Someclass sc = Someclass ();" is an interesting
> suggestion. It could allow very concise code with auto type inference, like:
> auto sc = Someclass ();
Heh, I can live without C++-style
SomeClass sc2();
As for
auto sc = SomeClass();
that is even closer to how Python does it (it even drops the "auto" as
it is a dynamically typed language; I don't suggest that here), and
would be pretty cool to have in D.
-Kirk McDonald
More information about the Digitalmars-d
mailing list