Replies: 1 comment 1 reply
-
I don't remember the details for the class-based choice, and certainly wasn't following a specific standard or was aware of the subtleties you mentioned. I am excited to see you implement proper quote, quasi-quote and splice handling, something I never came around doing. Given your reasoning I don't see why you would want to stick with the class-based approach. The cons-based approach seems more in the spirit of Lisp and probably even simpler longer term? I've enabled discussions on this repo, and moved this over there. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
(This is more of a discussion item than an issue, but discussions are not enabled on this repo.)I've been working on my fork (see #5) of the Lisp example, and when implementing splicing I noticed an interesting consequence of the current implementation of quote syntax.
Currently when a
'
is encountered the next atom is wrapped with an instance of theQuote
class. This makes the quote-handling code quite succinct and clean, but:As I understand it, many (most? all?) Lisps implement quote syntax by transforming
'foo
into the list(quote foo)
wherequote
is a symbol. The evaluator then recognizes this form and handles it specially.It's important to note that
'
parses into a cons list, because in some edge cases this results in behavior that not only diverges, but cannot even be expressed with the class-based parsing of Petit Lisp. A specific example I happened across:Emacs, Guile, and SBCL all agree that this expands to
(quote 1 2)
, which cannot be expressed with the Quote class in Petit Lisp.(
(quote 1 2)
is not the same as'(1 2)
→(quote (1 2))
, which is expressable in Petit Lisp asQuote(Cons(1, Cons(2))
. The closest you can get to the former would beCons(Name('quote'), Cons(1, Cons(2)))
.)My question is: What was the motivation behind the class-based quote implementation? Was this divergence intentional? Is this divergence a big enough problem to move to a cons-based implementation?
My feeling is that this is unimportant for basically all real-world purposes, but if for instance one were to aim for passing some sort of compatibility test then it could be a problem.
Beta Was this translation helpful? Give feedback.
All reactions