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

mutable/immutable




   Date: Thu, 30 Sep 93 17:07:05 -0400
   From: Michael R. Blair <ziggy@martigny.ai.mit.edu>

   Is this an oversight or is there some subtle rationale behind the following:

    literals are constants and therefore immutable.
    other constructed composite data are mutable.

    There is/are no predicate(s) to test mutability.

I think (tell me if I'm wrong) that constants are immutable to allow
sharing of constants.  Predicates to decide mutability would require
to maintain run-time information about mutability -- which could be
expensive in some implementations.

Also, some systems use Scheme itself to compile the Scheme code.  Those
systems would need to be augmented by procedures like

	(immutable-cons <obj1> <obj2>)
	(list->immutable-vector <list>)

etc.  (The ``constants'' of the user program are not ``constant'' in
the compiler.)

-Matthias