ModuleInfo, Object.localClasses(), and Object.find() - any users?

cc cc at nevernet.com
Mon Dec 12 20:40:09 UTC 2022


On Friday, 9 December 2022 at 22:20:28 UTC, Walter Bright wrote:
> Currently, the ModuleInfo struct generated for each module also 
> includes a pointer to the ClassInfo for every class in that 
> module.
>
> The only reference to this data is in the functions 
> Object.localClasses() and Object.find(). The idea is to be able 
> to instantiate a class via a text string rather than a link to 
> the name.
>
> This adds a lot of extra size.
>
> 1. Does anybody use Object.localClasses() or Object.find() ?
>
> 2. Does anybody need them?
>
> 3. Could it be changed to only include the classes marked 
> `export` ?
>
> 4. Could we just remove it entirely?

This would affect Object.factory, yes?  I've used that previously 
in commercial software.
Can partially work around it with `std.traits.moduleName` and 
`__traits(allMembers, somemodule)`, but what other options are 
there for finding classes outside of the current module other 
than those explicitly referenced in the calling module?


More information about the Digitalmars-d mailing list