Suggestion: Implicit Derived[]-to-Base[] conversions should be disallowed
James Dennett
jdennett at acm.org
Tue Jan 30 10:57:44 PST 2007
maXmo wrote:
>> we can write generic array operations by them, not relying on Derived[]-to-Base[] conversions.
>
> but wouldn't templates bloat your code? I don't know
> how D deals with them but in C++ when you instantiate
> template with different parameters you get several
> instances of the template, all the templated code gets copied.
Except when it doesn't, such as when an implementation
notices that the generated code is the same (such as
when the templated is instantiated over a number of
types whose representations and behavior at the level
of machine code is identical) and collapses them to a
single instance.
It's good to distinguish features that are *forced* by
a language design choice and those which depend on how
an implementation chooses to work. (It's also good to
take into account how much work is involved in the
implementation of a feature; if it's too much, it likely
won't be done well.)
-- James
More information about the Digitalmars-d
mailing list