Effects of having multiple TypeInfo with the same type name and the future of Object.factory

Steven Schveighoffer schveiguy at gmail.com
Mon Nov 22 20:18:57 UTC 2021


On 11/22/21 4:42 AM, Ahmet Sait wrote:

> What do you think about Object.factory? It works by iterating TypeInfo 
> fields from ModuleInfo and constructs the object if it finds one that 
> matches the given type name. This of course breaks when there are more 
> than a single type with the same name. Do you have a solution in mind to 
> fix it? Also, it is possible to create a similar functionality to 
> Object.factory with the existing meta-programming machinary so it's of 
> questionable value. How would you feel if Object.factory gets deprecated?

Object.factory should be deprecated. Anyone using it is in for trouble. 
It already does not work in some cases.

-Steve


More information about the Digitalmars-d mailing list