I'm trying to implement a programming language in Common Lisp by following this implementation in Java (https://craftinginterpreters.com/control-flow.html).
One of the things that was being really bothersome is plenty of slot-values everywhere.
Granted I can add a line in each function with with-slots, but that's also repetitive, and given that my symbols are not :used but I refer to them by the package, as there is plenty of symbols from many modules and I don't want to lose track from where they come from, even with-slots requires the full qualified name. All this seems to me like very bad code smell.
I googled and found rutils. With its @object.slot accessor I managed to clean up my code immensely. Just look at the last commit https://github.com/AlbertoEAF/cl-lox/commit/84c0d62bf29bff9a2e0e77042a9108c168542b96?diff=split excerpt:
(I could paste the code but all of it is available on that repo, I wanted to show the diff highlights)
Not only it removes some characters, but more importantly, there's one less level of depth (slot-value call) and parenthesis to think about - which helps a lot but for the trivial functions.
It gets worse when I have lots and lots of symbol names and can no longer export them all because I start having conflicts in symbols.
Can you guys give me input on the code? This looks much better now but I'm curious as if to are better ways to go about it?
Thanks!