Object.factory() and exe file size bloat
Martin Nowak via Digitalmars-d
digitalmars-d at puremagic.com
Sat Aug 22 02:44:47 PDT 2015
On Friday, 21 August 2015 at 05:06:47 UTC, Walter Bright wrote:
> The solution seems straightforward - only have Object.factory
> be able to instantiate classes marked as 'export'. This only
> makes sense anyway.
The export seems to be an arbitrary rule (and export is really
broken currently).
Let's just use every class that is linked into the binary (e.g.
weakly referencing them), then it'll naturally work with all
linker functionalities.
This doesn't only affect Object.factory but also
ModuleInfo.localClasses.
I'd suggest we first add a new internal array of weakly linked
classes, turn localClasses into an opApply function or range so
it automatically skips null classes (weakly undefined), then
change Object.factory to only load weakly linked classes.
For an intermediate time we can keep the old array and print a
deprecation warning in Object.factory when a class would no
longer be available.
https://github.com/D-Programming-Language/dmd/pull/4638
More information about the Digitalmars-d
mailing list