lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hallo,

On Tue, Feb 21, 2012 at 3:11 PM, Jay Carlson <nop@nop.com> wrote:
>
> Well, since I mentioned him, John Ramsdell did propose that Scheme do
> this a while back. "Imitation is the most sincere form of flattery,
> and I believe the Scheme community should flatter the ML community."
> Scheme would lose set-car!/set-cdr!, and make variables bind to
> values, not locations. To keep people from losing their minds, he
> added make-cell, cell-ref, and cell-set! to explicitly mark
> mutability. It might be worth thinking about how your Scheme code
> would change--although stack-like variables known not to escape could
> be an interesting place to hide mutability.
>

Actually most Scheme compilers bind variables to values, not
locations, when the variable is not set!. When a variable is set!, a
box, or cell, is created by the compiler front-end. This makes
compiling and optimising much easier.

What some implementations of Scheme did, notably Racket, was to make
*pairs* immutable by default, therefore set-{car,cdr}! cannot be used
on them, but on the new type "mutable pair".

-- 
-alex
http://www.artisancoder.com/