I forgot the list ...
------ Weitergeleitete Nachricht -------- Von: Marcel Taeumel marcel.taeumel@hpi.de Datum: 14.02.2018 11:35:39 Betreff: Re: [ReviewRequest 2] Error-handling and use of `future` An: Tony Garnock-Jones tonyg@leastfixedpoint.com
Hi Toni,
if it is a "promise", why aren't the states "kept" and "broken"? Or "delivered" and "broken"? Well, "resolve" sounds more like message lookup/sending, yet promises do actually make use of that mechanism here.
... #onDelivery: ... #onBreak: ...
:-)
Best, Marcel Am 14.02.2018 09:04:35 schrieb Tony Garnock-Jones tonyg@leastfixedpoint.com: Hi Marcel,
On 02/14/2018 06:58 AM, Marcel Taeumel wrote:
could elaborate on what it means, in general, to "reject a promise"? Does rejection directly map to the exception mechanism? Or are there other cases?
It's terminology lifted from https://promisesaplus.com/, and it is more general than the exception mechanism. One advantage of this generality is that it is able to usefully propagate failures in a concurrent system in a way that the stack-oriented nature of exception propagation cannot.
Briefly: a promise is a calculation that may yield either a result or a failure, each with an associated value. A failure value may be any value, Exception, nil, String, or otherwise. In Squeak, the "resolved" handlers are notified if the promise yields a result, and the "rejected" handlers are notified if the promise yields a failure.
The connection to exceptions is that in most cases a signaled exception should cause a promise to yield a failure.
There's a connection in the reverse direction, too: Promise>>#wait will signal BrokenPromise if a promise yields a failure.
Rejection is a new-ish (2013?) feature of Squeak promises that doesn't seem to have been properly integrated; the changes I've been making recently feel to me like more fully fleshing out the idea. One nice side-effect of the partiality of the integration of rejection is that no-one can possibly have been using it :-) leaving us free to assign sensible semantics to it without fear of backwards-compatibility problems.
Tony
The term "rejection" is commonly used in other languages, so I'd rather not invent a new term unless we have a good reason.
- Bert -
On 14 February 2018 at 11:36, Marcel Taeumel marcel.taeumel@hpi.de wrote:
I forgot the list ...
------ Weitergeleitete Nachricht -------- Von: Marcel Taeumel marcel.taeumel@hpi.de Datum: 14.02.2018 11:35:39 Betreff: Re: [ReviewRequest 2] Error-handling and use of `future` An: Tony Garnock-Jones tonyg@leastfixedpoint.com Hi Toni,
if it is a "promise", why aren't the states "kept" and "broken"? Or "delivered" and "broken"? Well, "resolve" sounds more like message lookup/sending, yet promises do actually make use of that mechanism here.
... #onDelivery: ... #onBreak: ...
:-)
Best, Marcel
Am 14.02.2018 09:04:35 schrieb Tony Garnock-Jones < tonyg@leastfixedpoint.com>: Hi Marcel,
On 02/14/2018 06:58 AM, Marcel Taeumel wrote:
could elaborate on what it means, in general, to "reject a promise"? Does rejection directly map to the exception mechanism? Or are there other cases?
It's terminology lifted from https://promisesaplus.com/, and it is more general than the exception mechanism. One advantage of this generality is that it is able to usefully propagate failures in a concurrent system in a way that the stack-oriented nature of exception propagation cannot.
Briefly: a promise is a calculation that may yield either a result or a failure, each with an associated value. A failure value may be any value, Exception, nil, String, or otherwise. In Squeak, the "resolved" handlers are notified if the promise yields a result, and the "rejected" handlers are notified if the promise yields a failure.
The connection to exceptions is that in most cases a signaled exception should cause a promise to yield a failure.
There's a connection in the reverse direction, too: Promise>>#wait will signal BrokenPromise if a promise yields a failure.
Rejection is a new-ish (2013?) feature of Squeak promises that doesn't seem to have been properly integrated; the changes I've been making recently feel to me like more fully fleshing out the idea. One nice side-effect of the partiality of the integration of rejection is that no-one can possibly have been using it :-) leaving us free to assign sensible semantics to it without fear of backwards-compatibility problems.
Tony
Hi Tony,
On Wed, Feb 14, 2018 at 2:36 AM, Marcel Taeumel marcel.taeumel@hpi.de wrote:
I forgot the list ...
------ Weitergeleitete Nachricht -------- Von: Marcel Taeumel marcel.taeumel@hpi.de Datum: 14.02.2018 11:35:39 Betreff: Re: [ReviewRequest 2] Error-handling and use of `future` An: Tony Garnock-Jones tonyg@leastfixedpoint.com Hi Toni,
if it is a "promise", why aren't the states "kept" and "broken"? Or "delivered" and "broken"? Well, "resolve" sounds more like message lookup/sending, yet promises do actually make use of that mechanism here.
... #onDelivery: ... #onBreak: ...
:-)
Best, Marcel
Am 14.02.2018 09:04:35 schrieb Tony Garnock-Jones < tonyg@leastfixedpoint.com>: Hi Marcel,
On 02/14/2018 06:58 AM, Marcel Taeumel wrote:
could elaborate on what it means, in general, to "reject a promise"? Does rejection directly map to the exception mechanism? Or are there other cases?
It's terminology lifted from https://promisesaplus.com/, and it is more general than the exception mechanism. One advantage of this generality is that it is able to usefully propagate failures in a concurrent system in a way that the stack-oriented nature of exception propagation cannot.
One thing to think about is that, because exception handling in Smalltalk is above the VM, exception handling does not have to be limited to a stack-oriented propagation. There is no reason why promises could not keep track of their creating environments and that exception propagation could be modified to cross promise boundaries, searching for handlers within their originating contexts.
Perhaps this is what the onRejected: mechanism does. But I've wondered for a few years (without playing, and so my thoughts are vapor and probably quite ill-formed) that such a system could be more convenient.
This line of thought originated in Croquet, which is heavily promise based. One of the problems in a promise based system is debugging; promises are not easy to relate back to their origin. With suitable support form the Vm for garbage collection promises appropriately it might be possible to have promises hold onto their originating environments so that when an uncaught exception does occur in a promise one can make sense of its history. The support needed would include the kind of stack splitting/cloning one sees in Scheme with call/cc where, when a continuation is created the stack is lazily split as either the parent or child continuation returns, frame by frame, leaving the other continuation with a fully formed stack that can be used to understand the computational history.
Briefly: a promise is a calculation that may yield either a result or a failure, each with an associated value. A failure value may be any value, Exception, nil, String, or otherwise. In Squeak, the "resolved" handlers are notified if the promise yields a result, and the "rejected" handlers are notified if the promise yields a failure.
The connection to exceptions is that in most cases a signaled exception should cause a promise to yield a failure.
There's a connection in the reverse direction, too: Promise>>#wait will signal BrokenPromise if a promise yields a failure.
Rejection is a new-ish (2013?) feature of Squeak promises that doesn't seem to have been properly integrated; the changes I've been making recently feel to me like more fully fleshing out the idea. One nice side-effect of the partiality of the integration of rejection is that no-one can possibly have been using it :-) leaving us free to assign sensible semantics to it without fear of backwards-compatibility problems.
Tony
I have been working on my code for awhile now, years. My Raven code also provides Promise execution, though the promise returned from an eventual {future} send is also eventual to the resolution, meaning you can also eventually send to the promise of future resolution.
Raven is distributed so a small actors model is provided: See RemoteHandler. After publishing an object, in one vat-machine, a different vat-machine can obtain a remote promise which eventually resolves to a far reference (see NewFarERef)..
http://www.squeaksource.com/Cryptography/Raven-HenryHouse.21.mcz
See PromiseERef. And tests, please.
This allows promise chaining: (42 eventual * 10) hash asString length
I am confused how my code may propagate exceptions thrown when eventually computing. Supposed to Break with BrokenERef and propionate eventually through whenBroken:. Maybe have a default breakReactor for opening the debugger that gets overridden.
How did you implement promise exceptions within the extant promises? Is there any thoughts on integrating this implementation? It derives from http://Erights.org ELib, best as I knew how.
Sent from ProtonMail Mobile
On Thu, Feb 15, 2018 at 14:34, Eliot Miranda eliot.miranda@gmail.com wrote:
Hi Tony,
On Wed, Feb 14, 2018 at 2:36 AM, Marcel Taeumel marcel.taeumel@hpi.de wrote:
I forgot the list ...
------ Weitergeleitete Nachricht -------- Von: Marcel Taeumel marcel.taeumel@hpi.de Datum: 14.02.2018 11:35:39 Betreff: Re: [ReviewRequest 2] Error-handling and use of `future` An: Tony Garnock-Jones tonyg@leastfixedpoint.com
Hi Toni,
if it is a "promise", why aren't the states "kept" and "broken"? Or "delivered" and "broken"? Well, "resolve" sounds more like message lookup/sending, yet promises do actually make use of that mechanism here.
... #onDelivery: ... #onBreak: ...
:-)
Best, Marcel
Am 14.02.2018 09:04:35 schrieb Tony Garnock-Jones tonyg@leastfixedpoint.com:
Hi Marcel,
On 02/14/2018 06:58 AM, Marcel Taeumel wrote:
could elaborate on what it means, in general, to "reject a promise"? Does rejection directly map to the exception mechanism? Or are there other cases?
It's terminology lifted from https://promisesaplus.com/, and it is more general than the exception mechanism. One advantage of this generality is that it is able to usefully propagate failures in a concurrent system in a way that the stack-oriented nature of exception propagation cannot.
One thing to think about is that, because exception handling in Smalltalk is above the VM, exception handling does not have to be limited to a stack-oriented propagation. There is no reason why promises could not keep track of their creating environments and that exception propagation could be modified to cross promise boundaries, searching for handlers within their originating contexts.
Perhaps this is what the onRejected: mechanism does. But I've wondered for a few years (without playing, and so my thoughts are vapor and probably quite ill-formed) that such a system could be more convenient.
This line of thought originated in Croquet, which is heavily promise based. One of the problems in a promise based system is debugging; promises are not easy to relate back to their origin. With suitable support form the Vm for garbage collection promises appropriately it might be possible to have promises hold onto their originating environments so that when an uncaught exception does occur in a promise one can make sense of its history. The support needed would include the kind of stack splitting/cloning one sees in Scheme with call/cc where, when a continuation is created the stack is lazily split as either the parent or child continuation returns, frame by frame, leaving the other continuation with a fully formed stack that can be used to understand the computational history.
Briefly: a promise is a calculation that may yield either a result or a failure, each with an associated value. A failure value may be any value, Exception, nil, String, or otherwise. In Squeak, the "resolved" handlers are notified if the promise yields a result, and the "rejected" handlers are notified if the promise yields a failure.
The connection to exceptions is that in most cases a signaled exception should cause a promise to yield a failure.
There's a connection in the reverse direction, too: Promise>>#wait will signal BrokenPromise if a promise yields a failure.
Rejection is a new-ish (2013?) feature of Squeak promises that doesn't seem to have been properly integrated; the changes I've been making recently feel to me like more fully fleshing out the idea. One nice side-effect of the partiality of the integration of rejection is that no-one can possibly have been using it :-) leaving us free to assign sensible semantics to it without fear of backwards-compatibility problems.
Tony
--
_,,,^..^,,,_ best, Eliot
Hi Henry,
On 02/16/2018 04:30 PM, henry wrote:
http://www.squeaksource.com/Cryptography/Raven-HenryHouse.21.mcz
This looks fascinating! I'd love to play with it, but I am having trouble loading it into an image.
It seems to depend on at least:
- STON - Cryptography
The STON dependency, if ignored, at least lets the Raven mcz load, but during class initialization there are problems with ASN.1 and a missing class called "PhaseHeader".
Do you have a series of steps that would let Raven load cleanly into a fresh Trunk image?
How did you implement promise exceptions within the extant promises? Is there any thoughts on integrating this implementation? It derives from http://Erights.org%C2%A0ELib, best as I knew how.
At present, Promise signals BrokenPromise when a client synchronously waits on the result. That's the only real support there is, aside from the recently-proposed changes to the `future` mechanism to catch exceptions from `future` message-sends and turn them into rejected promises.
It'd be neat to harvest some of the great work that went into Squeak-E for mainline Squeak. If not the code, than at least some of the designs.
Tony
Apologies for not mentioning the dependencies. Please load Cryptography, ParrotTalk, STON suitable for Squeak, then load Raven (which was SqueakE).
Sent from ProtonMail Mobile
On Sun, Feb 18, 2018 at 09:57, Tony Garnock-Jones tonyg@leastfixedpoint.com wrote:
Hi Henry, On 02/16/2018 04:30 PM, henry wrote: > http://www.squeaksource.com/Cryptography/Raven-HenryHouse.21.mcz This looks fascinating! I'd love to play with it, but I am having trouble loading it into an image. It seems to depend on at least: - STON - Cryptography The STON dependency, if ignored, at least lets the Raven mcz load, but during class initialization there are problems with ASN.1 and a missing class called "PhaseHeader". Do you have a series of steps that would let Raven load cleanly into a fresh Trunk image? > How did you implement promise exceptions within the extant promises? Is > there any thoughts on integrating this implementation? It derives from > http://Erights.org ELib, best as I knew how. At present, Promise signals BrokenPromise when a client synchronously waits on the result. That's the only real support there is, aside from the recently-proposed changes to the `future` mechanism to catch exceptions from `future` message-sends and turn them into rejected promises. It'd be neat to harvest some of the great work that went into Squeak-E for mainline Squeak. If not the code, than at least some of the designs. Tony
Hi Henry,
On 02/18/2018 03:02 PM, henry wrote:
Cryptography,
I loaded Cryptography-rww.115.mcz from Squeaksource.
ParrotTalk,
ParrotTalk-rww.19.mcz, also from the Squeaksource Cryptography project.
I think this is the piece I was missing before.
STON suitable for Squeak,
I installed ConfigurationOfSton from http://ss3.gemtalksystems.com/ss/STON, and executed
ConfigurationOfSton load.
This gets stuck trying to retrieve Metacello (!) from seaside.gemstone.com.
I abandoned loading STON for now.
then load Raven (which was SqueakE).
I loaded Raven-HenryHouse.21.mcz, also from the Squeaksource Cryptography project, and it seemed to load OK (barring the missing STON classes!). Hooray!
Thank you. I'll explore a little.
Tony
I was confused which STON to read into Squeak so I experimented and came up with these three packages:
http://www.squeaksource.com/Oceanside/Ston-Core-SvenVanCaekenberghe.36.mcz
http://www.squeaksource.com/Oceanside/STON-Text%20support-TheIntegrator.2.mc...
http://www.squeaksource.com/Oceanside/Ston-Tests-SvenVanCaekenberghe.34.mcz
- HTH
-------- Original Message -------- On February 18, 2018 12:19 PM, Tony Garnock-Jones tonyg@leastfixedpoint.com wrote:
Hi Henry,
On 02/18/2018 03:02 PM, henry wrote:
Cryptography,
I loaded Cryptography-rww.115.mcz from Squeaksource.
ParrotTalk,
ParrotTalk-rww.19.mcz, also from the Squeaksource Cryptography project.
I think this is the piece I was missing before.
STON suitable for Squeak,
I installed ConfigurationOfSton from http://ss3.gemtalksystems.com/ss/STON, and executed
ConfigurationOfSton load.
This gets stuck trying to retrieve Metacello (!) from seaside.gemstone.com.
I abandoned loading STON for now.
then load Raven (which was SqueakE).
I loaded Raven-HenryHouse.21.mcz, also from the Squeaksource Cryptography project, and it seemed to load OK (barring the missing STON classes!). Hooray!
Thank you. I'll explore a little.
Tony
Hi Eliot,
On 02/15/2018 07:34 PM, Eliot Miranda wrote:
One thing to think about is that, because exception handling in Smalltalk is above the VM, exception handling does not have to be limited to a stack-oriented propagation. There is no reason why promises could not keep track of their creating environments and that exception propagation could be modified to cross promise boundaries, searching for handlers within their originating contexts.
Yes, that's a neat idea. I've been mulling over something similar, regarding callbacks attached to Promises. Sometimes it's OK to run them in the context of the UI process, but other times they really want to be run in the context of the process that was running at the time they were attached to the Promise. I'm still thinking about what the smallest change I can get away with might be.
In general, exceptions per se - or rather, stack-based exception *handler* mechanisms - don't adapt well to a concurrent setting. Miller, Tribble and Shapiro's "Concurrency Among Strangers" (2005) [1] is great on this topic. Their idea of "plan interference" really captures the problem well.
[1] http://www.erights.org/talks/promises/paper/tgc05.pdf
However, aside from the E-style techniques, an Erlang style design works quite well. There, stack-oriented exceptions and exception handlers cope with error signalling and recovery within a process, and Erlang's "link" mechanism propagates entire actor failures among processes. (In some ways this is reminiscent of E's two-layered design, with vats containing objects.)
Perhaps this is what the onRejected: mechanism does. But I've wondered for a few years (without playing, and so my thoughts are vapor and probably quite ill-formed) that such a system could be more convenient.
Yep. My recently-completed doctoral work was on a new actor/tuplespace inspired hybrid model of concurrency that in some ways makes things like error signalling and recovery less terrible. (See http://syndicate-lang.org/tonyg-dissertation/ if you're interested.)
might be possible to have promises hold onto their originating environments so that when an uncaught exception does occur in a promise one can make sense of its history.
Recording this kind of causal information is hard, but could be worthwhile. I don't yet have enough experience with Promises to be able to do the design work. I wonder if there's an overlap with "E-order". I've always had trouble digging through erights.org enough to get a clear picture on exactly what E-order entails.
Cheers, Tony
On 18 February 2018 at 07:12, Tony Garnock-Jones tonyg@leastfixedpoint.com wrote:
Hi Eliot,
On 02/15/2018 07:34 PM, Eliot Miranda wrote:
One thing to think about is that, because exception handling in Smalltalk is above the VM, exception handling does not have to be limited to a stack-oriented propagation. There is no reason why promises could not keep track of their creating environments and that exception propagation could be modified to cross promise boundaries, searching for handlers within their originating contexts.
Yes, that's a neat idea. I've been mulling over something similar, regarding callbacks attached to Promises. Sometimes it's OK to run them in the context of the UI process, but other times they really want to be run in the context of the process that was running at the time they were attached to the Promise. I'm still thinking about what the smallest change I can get away with might be.
In general, exceptions per se - or rather, stack-based exception *handler* mechanisms - don't adapt well to a concurrent setting. Miller, Tribble and Shapiro's "Concurrency Among Strangers" (2005) [1] is great on this topic. Their idea of "plan interference" really captures the problem well.
[1] http://www.erights.org/talks/promises/paper/tgc05.pdf
However, aside from the E-style techniques, an Erlang style design works quite well. There, stack-oriented exceptions and exception handlers cope with error signalling and recovery within a process, and Erlang's "link" mechanism propagates entire actor failures among processes. (In some ways this is reminiscent of E's two-layered design, with vats containing objects.)
Perhaps this is what the onRejected: mechanism does. But I've wondered for a few years (without playing, and so my thoughts are vapor and probably quite ill-formed) that such a system could be more convenient.
Yep. My recently-completed doctoral work was on a new actor/tuplespace inspired hybrid model of concurrency that in some ways makes things like error signalling and recovery less terrible. (See http://syndicate-lang.org/tonyg-dissertation/ if you're interested.)
Congratulations!
might be possible to have promises hold onto their originating environments so that when an uncaught exception does occur in a promise one can make sense of its history.
Recording this kind of causal information is hard, but could be worthwhile. I don't yet have enough experience with Promises to be able to do the design work. I wonder if there's an overlap with "E-order". I've always had trouble digging through erights.org enough to get a clear picture on exactly what E-order entails.
C# Tasks (promises) routinely keep track of their "stack", for what it's worth. I've never had a need to look into how exactly they do this, but maybe that's an avenue to explore?
Debugging Task-based code never feels any different to debugging "normal" code, FWIW. (Of course that may well be because I make sure my colleagues use immutable data structures and all that...)
frank
Cheers, Tony
squeak-dev@lists.squeakfoundation.org