Todd,

>> lastly, are weak references first-class in avail?
> 
> Mark and I have reasoned that weakness implies identity, and is therefore 
> inappropriate for most values in Avail. Weakness is certainly useful for 
> identities though, but is currently not supported. Mark and I have talked 
> about supporting weakness at some point in the future, because weak sets and 
> maps are obviously very powerful. Weak sets and maps would themselves have to 
> be identities, rather than values. (Ordinary sets and maps are just 
> identityless values in Avail.)

indeed, weak versions of set and map have to have identity and doesn’t sit well 
with the language.

>> i need this to be able to hash-cons objects (via weak maps)
> 
> Avail supports coalescence of equal objects through indirections. Check out 
> IndirectionDescriptor, and the becomeIndirectionTo() method of A_BasicObject 
> / AvailObject. The basic idea is that the equals() operation is usually 
> permitted to replace one of two semantically equal participants with an 
> indirection to the other; the method isBetterRepresentationThan() helps 
> equals() decide which of two semantically equal objects is preferable (and 
> which should become the indirection). Eventually Avail will run natively and 
> provide its own garbage collector, at which time we will be able to rewrite 
> indirections into strong pointers.

from the java documentation, i understand that a (avail native) garbage 
collector can decide to coalescence equal objects, while it traverses the live 
set.
That’s a very cool idea.

but is it possible to somehow implement hash-consing (a-priori coalescence) in 
avail?
i want hash-consing to be able to do garbage collectable memoization.
via indirections, it appears you can only achieve a-posteriori coalescence via 
equals?

anyway, i think it is great that avail has all these notions baked in, and not 
as a afterthought.
indeed, avail is truly about advanced value and identity programming!

i don’t understand why avail isn’t getting much love on the internet.
for me it’s the best next thing since sliced bread.

cheers,
Robbert.

Reply via email to