[R6RS] Re: Zapping SET-CAR! & SET-CDR!

R. Kent Dybvig dyb
Tue Oct 26 12:39:46 EDT 2004


> Moreover, as I pointed out at the workshop, the #n= and
> #n# syntaxes for shared structures that contain lists, could not be
> implemented in Scheme (you need set-car! and set-cdr! for that).

Actually, the #n=/#n# syntaxes can be implemented for shared structure and
any cyclic structure that can be created by mutating some mutable object.
For example, (#1=(a b c) #1#) is no problem, and both #1=#((#1#)) and
#1=(#(#1#)) can be created by mutating the vector instead of the pair.
Chez Scheme's reader already has to deal with this issue to handle marks
and references in immutable record fields, and it's not a big deal.

All we'd be losing is the ability to create cycles that can only be
created by mutating immutable fields.  This is just a natural consequence
of the immutability.

Kent


More information about the R6RS mailing list