Object.factory() and exe file size bloat

rsw0x via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 21 16:22:15 PDT 2015


On Friday, 21 August 2015 at 21:59:30 UTC, deadalnix wrote:
>
> Such a feature can be used to make sure that all child have a 
> mechanism to register themselves int he factory. Something à la
>
> class Base {
>     super mixin {
>         shared this() {
>             library.register(typeid(typeof(this)));
>         }
>     }
> }
>
> class Child : Base {
>     // The super mixin also gets expanded here.
>     // But this does not have the same type.
>     // Both end up being registered, whatever that means.
> }
>
> Such a solution can be leveraged by any library or user to do 
> whatever they want. Sounds a better approach to me that 
> introducing hacks.

+1, this seems like a great solution.

now if only typeinfo could be completely redone...


More information about the Digitalmars-d mailing list