DIP 45 - approval discussion

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Nov 12 18:48:52 PST 2013


On 11/12/13 6:26 PM, Timon Gehr wrote:
> On 11/13/2013 03:15 AM, Andrei Alexandrescu wrote:
>> ...
>>>>> - If I know the fully qualified name of a class, there are better ways
>>>>> to instantiate this class than passing a string containing that
>>>>> name to
>>>>> Object.factory in order to call the default constructor.
>>>>
>>>> What are the better ways?
>>>
>>> Call the default constructor. Call a delegate/virtual function that
>>> calls the default constructor.
>>
>> Wait, doesn't Object.factory call the default constructor of the created
>> object?
>> ...
>
> Yes, I was listing some ways to do this that I think are better than
> calling Object.factory.

OK I think I figure you are confused. You can't call the default 
constructor of an object you don't know the type of.

Andrei



More information about the Digitalmars-d mailing list