[Issue 14758] TypeInfo causes excessive binary bloat

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Aug 19 23:46:09 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14758

--- Comment #2 from Mike <slavo5150 at yahoo.com> ---
(In reply to Dmitry Olshansky from comment #1)

> I'd just go for structs + template mixins for inheritance. It's not like you
> do any of virtual calls/typeinfo/object factory/whatever.
> 
> mixin template Register(blah...){ }
> 
> struct Peripheral{
> 
> mixin Register!(x,y,z,...);
> mixin Register!(q,w,e,...);
> 
> }
> 
> Makes any sesne?

Yes, it makes sense, but it is not my preference, and is beside the point of
this issue.  Furthermore, with your suggestions, you will still have a new type
for each peripheral, and therefore unwanted TypeInfo bloat for each and every
one of those peripherals.

The compiler/linker should generate efficient code using my pattern, and I
shouldn't have to compromise.  Nor should I have to add stubs for runtime
features that have no hope of every being used.  Rust does a good job with
this, and I don't see why I should have to lower my expectations for D.

--


More information about the Digitalmars-d-bugs mailing list