Bug in D!!!
EntangledQuanta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 30 14:30:46 PDT 2017
On Wednesday, 30 August 2017 at 21:13:19 UTC, Kagamin wrote:
> It can't work this way. You can try std.variant.
Sure it can! What are you talking about! std.variant has nothing
to do with it! It works if T is hard coded, so it should work
generically. What's the point of templates variables if they
can't be used across inheritance?
I could overload Go for each type and hence it should work. There
is absolutely no reason why it can't work. Replace T with short,
it works, replace T with anything and it works, hence it should
work with T.
If you are claiming that the compiler has to make a virtual
function for each T, that is nonsense, I only need it for
primitives, and there are a finite number of them. I could create
overloads for short, int, double, float, etc but why? The whole
point of templates is to solve that problem.
Variants do not help.
Openmethods can solve this problem too, but D should be more
intelligent than simply writing off all normal use cases because
someone thinks something can't be done. How many people thought
it was impossible to go to the moon, yet it happened. Anyone
can't deny anything, it's such a simple thing to do...
More information about the Digitalmars-d-learn
mailing list