On 6 March 2014 20:04, John Cowan <[email protected]> wrote:

> 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.
>

The idea is from Jörg, not me, but I think it's a great idea. I think you
made a good case for making pairs functional by default, but being able to
import set-car! and set-cdr!. I can see the hassle of having to rewrite
your code when you decide you need set-car!

The Racket blog post argues that library developers have to deal with the
possibility that lists they use might mutate. I haven't decided what I
think about that. My first impulse is that if the user wants to shoot
himself in the foot by mangling a list that he's passing to an external
library, that is not the library designer's problem. But I might be missing
something.

I am not experienced with reading RnRS standards, but my impression is that
R7RS does not require that set-car! and set-cdr! be moved to a separate
library.

Cheers,
Daniel.
_______________________________________________
Chicken-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to