-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SRFI 38 read does not use immutable pairs #877
Comments
I can't reproduce this - I consistently get an error calling set-car! on a literal:
|
Ahhhh, it’s immutable for me only if |
This is the SRFI 38 implementation. It's a little tedious to fix, in part because it's fully portable, and in part because it actually needs to use |
What about a procedure |
Sure, we could add that. Since it has to duplicate the shared structure detection of SRFI 38 it would be more work, but at the same time be generally useful. |
|
I'm not sure I follow. Are you suggesting a circular dependency? This doesn't really apply since the repl itself is not part of the standard. The SRFI 38 |
I have not had a suggestion yet. I mean from code portable point view, there are no issue at all. In REPL, |
Could fixing this be an opportunity to generally clean up the situation around reading and reader/writer extensions in Chibi? At the moment there are at least three implementations of a reader for S-expressions in the Chibi libraries, two of which have corresponding writers: one reader/writer in C in Could an approach comparable to the readtables of Common Lisp or Racket be used, so that e.g. |
Chibi is intentionally built in layers. The C reader/writer is fast and simple and handles all standard syntax but only reads, not writes, shared structures. The Scheme reader is actually the fully portable The Scribble reader is a <100 line implementation of a subset of Scheme, which allows interleaving Scribble code in with Scheme. I don't remember why it doesn't use A possible factoring would be a |
Scribble syntax allows @-expressions to be embedded in S-expressions and vice versa:
One inconsistency I just noticed which would be evened out by the universal use of character-based dispatch tables: the basic But I appreciate this would be a big change so I’m happy to drop it for now. |
chibi-scheme/sexp.c
Lines 3336 to 3338 in e93b719
I see that there are circumstances in which literal pairs become immutable, but I can’t work out when. Specifically, nothing I can think of like this works as expected at the REPL:
This includes changing the definition of
mypair
to any combination ofread
with a port (even having done an explicitport-source?-set!
to#t
on that port).I’m trying to implement an optimization of immutable lists in Chibi and am very confused by this.
The text was updated successfully, but these errors were encountered: