from-gof-to-lambda
from-gof-to-lambda copied to clipboard
Fix lambda visitor example
Gof visitor example has been fixed by https://github.com/mariofusco/from-gof-to-lambda/commit/f1f498d0f7f2e6d3c2e6c3daf76712b8c7b9eb47
... but then it leaves a clearly inferior lambda visitor implementation which does not guarantee at compile time that all 3 cases are handled (plus the implementation would not work for generic classes). This guarantee is what make the visitor pattern superior to using instanceof.
Hopefully this can be easily fixed with a little help from https://github.com/derive4j/derive4j (or equivalent manually written code).