Strange interaction between futures and failed futures

Raphael Collet raph at info.ucl.ac.be
Thu Jun 28 18:04:59 CEST 2001


> Here's an example:
> 
>    declare X F in
>    X={ByNeed fun {$} _ end}
>    F=!!X
> 
> Despite appearances, F is not a read-only variable.
> E.g., the following succeeds and binds F to foo:
> 
>    F=foo

I think what really happens is this.  The !! operation sees that Y is a
"future byNeed", and concludes that the future links can be
short-circuited (*), so it reduces in Z=Y.  You can observe this by
doing {Show Z} before Z=foo.

The deduction (*) above is correct if Y is a "future", i.e., !!(!!Y) is
equivalent to !!Y.  But it is wrong if Y is a "future byNeed", because
the lazy evaluation can return an unbound variable, which never happens
in a traditional functional language.

I think the bug came from the confusion between "future" and "future
byNeed".  I already complained about this.  Do you remember, Denys? :-)
This is why we proposed to consider ByNeed as primitive and define
MakeFut in terms of ByNeed.  All we need now is a distributed protocol
for ByNeed.  Per and I already have something in mind for this.

--
raph
-
Please send submissions to hackers at mozart-oz.org
and administriva mail to hackers-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.





More information about the mozart-hackers mailing list