[r6rs-discuss] set-car!

Eli Barzilay eli at barzilay.org
Fri Jun 22 17:56:56 EDT 2007


On Jun 22, Alan Watson wrote:
> William D Clinger wrote:
> 
> [Interesting but non-standard means to redefine the mutable-pairs
> library so that one can enforce a guarantee that pairs are not
> mutable.]
> 
> > A similar effect could be obtained under the R5RS by redefining
> > set-car! and set-cdr!, which all conforming implementations must
> > allow, but that's more awkward in the R5RS because there is no
> > standard way to signal an error.
> 
> Let me see if I have this straight.
> 
> With the R5RS we could redefine standard procedures but we did not
> have a standard way to signal an error.
> 
> With the R6RS we now have a standard way to signal an error but we
> no longer have a standard way to redefine standard procedures.
> 
> Was irony really one of the guiding principles of the R6RS or is
> this just one of those happy coincidences of history?

The irony is there only if you consider the ability to redefine
standard procedures as a good thing.  Some people don't.

In this specific case, I don't like it that my code depends on whoever
used the repl before me.  [Remove smart-ass toilet analogy.]  I don't
want `(set-car! my-list 123)' to work or break depending on possible
redefinitions, and I also don't like it that `(+ 6 7)' will
occasionally return 42.  I also don't like using misc compiler hacks
(compiler flags, declarations, or a global `(let () ...my-code...)'
wrapper) to allow optimizations.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!



More information about the r6rs-discuss mailing list