[r6rs-discuss] Recursively immutable objects and shared-nothing primitives?

From: John Cowan <cowan>
Date: Thu Mar 15 23:11:50 2007

Alexander Kjeldaas scripsit:

> When you don't have immutable objects, there is no way you can promise
> not to send mutable state from one process to another process. This
> means that for a scheme implementation - if you implement simple
> processes using continuations, there is no possibility for the
> implementation to have the continuations live in separate
> stacks/heaps.

R6RS Scheme has immutable booleans, characters, numbers, symbols,
and exceptional conditions. Furthermore, you can create immutable
objects of novel types using records -- the immutable equivalent
of pairs, strings, vectors, bytevectors, hash tables, ....

There is no portable way to look at a closure and see if it's
immutable, but a compiler can readily determine which closures
are in fact immutable (because nobody does a set! on any of the
lexically apparent variables).

> But there seems to be a need to be language-defined abstractions or
> functions that can:
> 1) Make immutable objects (so that communication between processes is
> possible including making a message queue).

See above.

> 2) Create a closure with an empty environment, or with an environment
> consisting only of immutable objects (so that moving a continuation to
> a different heap or machine is possible).

As I said, a compiler can figure that out, since it knows statically
which variables are immutable and which objects bound to immutable
variables are immutable.

> Implementing this on top of scheme is a non-solution as there is no
> way for the scheme implementation to know about "promises" you are
> making. The scheme implementation will not have the ability to
> migrate processes across machines or to a different heap or to respawn
> a failed process etc without the above being promises that are defined
> in the language.

Not full Scheme, no.

-- 
John Cowan  cowan_at_ccil.org    http://ccil.org/~cowan
No man is an island, entire of itself; every man is a piece of the
continent, a part of the main.  If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friends or of thine own were: any man's death diminishes me,
because I am involved in mankind, and therefore never send to know for
whom the bell tolls; it tolls for thee.  --John Donne
Received on Thu Mar 15 2007 - 23:11:44 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC