On Friday, 21 August 2015 at 05:06:47 UTC, 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?

Can't this be optional?
-slim-rtti        // hold the gravy
-verbose-rtti  // more gravy!


On Friday, 21 August 2015 at 20:26:29 UTC, Walter Bright wrote:
[...]
The principle often used by languages (C, C++, Rust) is you only pay for what you use. With Object.factory, every program pays for it with every class, despite very few actual uses of it.

Object.factory() would probably get more use if D provided a full solution in this category.

OffsetTypeInfo was never implemented, but is still collecting dust:
https://github.com/D-Programming-Language/druntime/blob/master/src/object.d#L197

I would love to see OffsetTypeInfo implemented, and have the field name included as well so it could be used for serialization.

I don't believe there has to be a "one size fits all" solution for this. Some people need small binaries, some need utility.

    Bit

Reply via email to