No we should not support enum types derived from strings
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Wed May 12 16:46:40 UTC 2021
On Wednesday, 12 May 2021 at 16:38:10 UTC, Ola Fosheim Grøstad
wrote:
> typeid(a) is A*, because that is the type of the pointer.
> However, the relationship between B* and A* is polymorphic,
> because you can use B* in the context where you expect A*? E.g.
> you can call a function that expects paramater A* with a
> pointer B*. So that makes the relationship polymorphic?
To be more precise. B* is a subtype of A* if you can use B* in
contexts where A* is expected, which is polymorphic in nature.
More interestingly, pure OO-languages like Beta provide
type-variables. C++/D lack those. So in such languages you can
bind new types to type-variables and therefore change the typing
of elements of arrays and such in subclasses.
(Which leads to other challenges, all languages seem to have some
kind of challenge associated with them once they allow
polymorphisms)
More information about the Digitalmars-d
mailing list