My experience with Sealed Types and Data-Oriented Programming
David Alayachew
davidalayachew at gmail.com
Sun Sep 11 04:41:02 UTC 2022
Hello Nathan,
> I'm glad it worked so well. I was dubious since you are parsing English.
Thank you very much. Yes, spoken languages carry so many more edge cases
than a programming/syntactic language. That's partly why I applauded
records and their maintainability. The main reason I kept refactoring my
code so much was to adapt to an edge case that I had forgotten/not thought
of.
> In general, I like to keep the parsing logic in the class of the
resulting object. This way each class deals with the specifics for that
class. The downside is that some logic may be duplicated.
Agreed. And yes, some duplication was involved, but frankly, it's a small
cost in comparison to the simplified flow. Now if only I could turn this
into some mapping that I could fetch from the sealed type. Someone else on
this thread suggested using annotations to serve as my bridge between
worlds. Let's see if that can serve as my mapping.
Thank you for your help!
David Alayachew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20220911/58040ed8/attachment.htm>
More information about the amber-dev
mailing list