Object.factory() and exe file size bloat

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Thu Aug 20 23:40:19 PDT 2015


On 2015-08-21 07:06, Walter Bright 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 think, or rather know, that this will break serialization, i.e. my 
library Orange [1]. I really like that one doesn't need to register a 
class to be able to (de)serialize it.

I can't believe this change is purposed that will clearly break valid 
code. But at the same time there are other breaking changes you refuse 
to do that would fix design flaws in the language.

I still remember your rant about your old D1 project that didn't compile 
with the latest D2 compiler.

[1] https://github.com/jacob-carlborg/orange

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list