[e-lang] multiway when-catch
Kevin Reid
kpreid at mac.com
Mon Oct 29 14:45:03 EDT 2007
On Oct 29, 2007, at 14:16, Rob Withers wrote:
> I've revived my work on SqueakElib and I am trying to implement the
> multiway when-catch. I have #whenResolved: and #whenBroken:
> defined and that is how I specify a when-catch; when-catch is not
> part of the language I use. I suppose my first question is: is
> when-catch defined in terms of #whenResolved: and #whenBroken:?
Yes.
> If so, what does it look like?
You can ask the implementation: just do interp.setExpand(true) then
enter the code you want to see the expansion of, or write it inside
of an e`...` quasiquote.
Most expansions use objects from the safe scope; look in jsrc/org/
erights/e/elang/scope/ScopeSetup.java to see what the bindings are.
> ... where #getFork returns an eventualRef and the #% message
> concatenates promises to create a promiseSet. Unfortunately,
> nothing holds onto the promiseSet so it is getting GCed. I suspect
> that I need to pass the promiseSet as an argument to #whenResolved:
> msgs sent to each promise, but I am not sure how.
I think your promiseSet corresponds to the components produced by
promiseAllFulfilled, which multiway-when uses, as you will see in the
expansion. I recommend that you simply compile/translate
promiseAllFulfilled.emaker to your platform, as it is entirely non-
primitive and well-designed.
Particularly, there should not be any weak references involved, so GC
is irrelevant.
--
Kevin Reid <http://homepage.mac.com/kpreid/>
More information about the e-lang
mailing list