|
From: | Daniel Carrera |
Subject: | Re: [Chicken-users] Question about set-car! and set-cdr! |
Date: | Thu, 6 Mar 2014 21:03:06 +0100 |
Ivan Shmakov scripsit:
> >> Maybe this could be addressed by splitting the "scheme" module of
> >> chicken into a "scheme-pure" for the sake of safety,
> >> "scheme-mutations" having the rest and make "scheme" importing and
> >> reexporting both sets of bindings.
>
> That’s what the Racket folks did: they have their own Scheme
> dialect without mutable pairs, and they have the “standard”
> Scheme(s) available as an option.
R6RS does what Daniel suggests, splitting at the module level only:
set-car! and set-cdr! are in a separate module, and if it's not imported
anywhere you know all pairs are functional, but there is only one
species of pairs. Racket makes normal pairs functional, and provides a
separate data structure, not interoperable with pairs, which is mutable.
That means if you are going to mutate anything, you have to potentially
change all your code to use mpairs instead of pairs, and duplicate it
for parts that should work on pairs. IMHO not a win.
[Prev in Thread] | Current Thread | [Next in Thread] |