Re: [Scheme-reports] Proposed new SRFI for immutable lists
vnikolov@pobox.com 04 Sep 2014 02:27 UTC
On Wed, 3 Sep 2014 15:17:22 +0900, Alex Shinn <alexshinn@gmail.com> said:
> On Wed, Sep 3, 2014 at 2:00 PM, Kevin Wortman <kwortman@gmail.com> wrote:
>> ...
>> Are cycles actually possible in strict immutable structures? When you
>> create a head node, there's no way for it to have a circular link to a tail
>> node that doesn't exist yet.
> Yes, if you provide implementation support for it,
> see http://docs.racket-lang.org/reference/shared.html
> Also for lazy data structures see
> http://www.haskell.org/haskellwiki/Tying_the_Knot,
> for which I have a Scheme version lying around somewhere.
By the way, some languages offer yet
another approach, in principle similar to
the latter, but more procedural. It is
to make the object construction protocol
a little more elaborate so the user (not
just the implementor) can see object
_allocation_ as a separate step from
object _initialization_. Probably
needless to add, in this way a reference
to the object becomes available (for
plugging into other objects) before the
construction of the object is finished
(with references to those other objects
plugged into it). This is just with
regards to the possibility of cycles in
strictly immutable structures; whether
this can be a candidate for adopting by
Scheme is another question.
There is also the more general approach
of "arbitrarily delayed once-only
component initialization", where any
component of an immutable object can be
initialized at any time after object
creation (no matter how much later), but
only once. If I recall correctly, Oz
allows (something like) that, but I
forget how exactly it is called there.
---Vassil.
--
Vassil Nikolov | Васил Николов | <vnikolov@pobox.com>
"Be careful how you fix what you don't understand." (Brooks 2010, 185)
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports