Cannot compare object.opEquals is not nogc
Lodovico Giaretta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 23 15:36:56 PDT 2016
On Saturday, 23 July 2016 at 21:44:05 UTC, Rufus Smith wrote:
> Templates are not the end all be all. They don't allow for
> run-time polymorphism, which is an important aspect of software.
Ok, so you need runtime polymorphism. And you want it in @nogc
code. That's not difficult. Just have the base class of your
hierarchy declare its opXXX @nogc. This is possible, because
non- at nogc functions can be overridden by @nogc ones (as logical).
Now you can have your function accept parameters of your base
class, and it will be @nogc. And without forcing every class of
the D world to have opXXX @nogc.
I don't see why this wouldn't be enough...
More information about the Digitalmars-d-learn
mailing list