[plt-scheme] Native code generation and immutable pairs

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Sun Feb 12 08:28:17 EST 2006

--- Gregory Woodhouse <gregory.woodhouse at sbcglobal.net>

> (To tell you the truth, I've really been puzzling over
> how an  
> application programmer might use boxes, but I've
> implicitly assumed  
> that pairs are mutable.)

The primary use in my experience is to simulate a mutable
binding.  Module bindings can only be mutated by the
defining module.  Sometimes it is useful to allow others to
mutate a binding, in which case storing the value in a box
is a solution.  However, it is almost always the wrong
solution -- parameters are better for most use cases, and
monads for pretty much all other cases I can think of,
leaving boxes for the cases where you want inexplicable
behaviour in the presence of concurrency and continuations.


Email: noelwelsh <at> yahoo <dot> com   noel <at> untyped <dot> com
AIM: noelhwelsh
Blogs: http://monospaced.blogspot.com/  http://www.untyped.com/untyping/

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

Posted on the users mailing list.