Is there an easy way to mimic generics with an accept method of a visitor pattern?
Mina
minallkamel at gmail.com
Thu Feb 18 11:14:05 UTC 2021
I'm following along with the crafting interpreters book
(https://craftinginterpreters.com) and it goes into implementing
a visitor pattern that returns generic types, so implementing it
in D came down to the accept method causing undefined symbol
error that goes away when changing it to returning a concrete
type, so here's what I've got working
(https://github.com/MKamelll/dlox/blob/main/source/loxast.d) and
here's the book's implementation
(https://github.com/munificent/craftinginterpreters/blob/master/java/com/craftinginterpreters/lox/Expr.java).
Thanks.
More information about the Digitalmars-d-learn
mailing list