[e-lang] "implements Selfless" is useful!
Mark Miller
erights at gmail.com
Sat Sep 15 16:33:41 EDT 2007
On 9/15/07, Kevin Reid <kpreid at mac.com> wrote:
> [...] and what
> should happen when an object does "implements Selfless" but not also
> Transparent (or any other supported means of comparison). We decided
> that such an object should be considered permanently *unsettled* (as
> a representation of "not possible to compare this").
When Kevin first proposed this, I misunderstood him to be proposing
that references to such objects be considered permanently
*unresolved*, which would be bad. So that other's don't make this
mistake, I thought I'd remind people of the distinction:
? def [x,xRes] := Ref.promise()
? def [y,yRes] := Ref.promise()
? def [a,aRes] := Ref.promise()
? def [b,bRes] := Ref.promise()
At this point, x, y, a, and b are unresolved promises.
? xRes.resolve([a, b])
? yRes.resolve([b, a])
At this point, a and b are still unresolved promises. x and y are both
resolved. They are now near references to two element lists. But x and
y are unsettled, because we don't yet know what other lists they are
the same as. In particular, until a and b are settled, we don't yet
know whether x and y are the same as each other. Therefore, we also
cannot yet allow x or y to serve as keys in hash tables.
? aRes.resolve(3)
? bRes.resolve(4)
x, y, a, b, are now all resolved and settled. We now know that x is
not the same as y.
> It has just occurred to me that this behavior is actually useful.
>
> Examples:
>
> 1. Hiding identity distinctions from clients:
Interesting. Should the value caught by "} catch ex {" add identity
hiding to the opacity with which it wraps the thrown value?
--
Text by me above is hereby placed in the public domain
Cheers,
--MarkM
More information about the e-lang
mailing list