defered new feature

BCS ao at pathlink.com
Thu Oct 23 13:53:46 PDT 2008


Reply to Andrei,

> BCS wrote:
> 
>> Reply to Andrei,
>> 
>>> BCS wrote:
>>> 
>>>> A number of times I have found my self wanting to have "new
>>>> C(args)" return a class derived from C. I know this can be done
>>>> with a static function or the like but syntactically, it's
>>>> unappealing.
>>>> 
>>> I'd say the stupid "new" is unappealing.
>>> 
>>> Andrei
>>> 
>> So you don't like "new" all together?
>> 
> I consider it an unnecessary appendage and a waste of two keywords
> (considering delete too).
> 

You can't dump delete (unless you propose having a delete property) because 
D still allows manual memory management.

>> Ok, then morph the idea to allow "the constructor call syntax" to do
>> the above.
>> 
> Then we're pretty much down to functions :o).
> 

Yes they might look the same, but /some/ magic will be needed to make overloading 
work because constructors already have some magic in them.

> Andrei
> 





More information about the Digitalmars-d mailing list