Object.factory() and exe file size bloat

Manu via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 22 16:33:03 PDT 2015


On 21 August 2015 at 15:06, Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> This function:
>
>   http://dlang.org/phobos/object.html#.Object.factory
>
> enables a program to instantiate any class defined in the program. To make
> it work, though, every class in the program has to have a TypeInfo generated
> for it. This leads to bloat:
>
>   https://issues.dlang.org/show_bug.cgi?id=14758
>
> and sometimes the bloat can be overwhelming.
>
> The solution seems straightforward - only have Object.factory be able to
> instantiate classes marked as 'export'. This only makes sense anyway.
>
> What do you think?

I don't follow the reasoning, but yes! Kill it with fire!
I'd rather see a compile option or something to disable it completely,
like how disabling RTTI is a common C++ option.


More information about the Digitalmars-d mailing list