Hi all,
At the moment, if I printIt (1 future / 0) this results in a Promise, as expected. Separately, when the UI process next runs (almost immediately), it ends up signalling ZeroDivide, causing a debugger to open. It does not either resolve or reject the promise. The promise remains pending forever, when it should be rejected. The attached changeset is small and simple, and fixes this problem. It spans several packages - Morphic, System, Kernel and KernelTest - which is why it's a changeset and not a bunch of submissions to the inbox. If people could take a look over it, that'd be great! If the consensus is that the change is an improvement, I'll commit to MC and update trunk. I have specific questions: 1. How should unhandled errors by `future` sends be treated? The current code, and the code after the attached changeset, always opens a debugger. Would it be better to *not* open a debugger, instead relying on the user of the Promise to care about #whenRejected:? I cautiously suggest this might be the case. (Concretely, in the language of the changeset, all that would change is that `true` in Promise>>fulfillWith: would become `false`.) 2. What code is using `future`? Where can I find some examples of code that (isn't already broken and that) might break if I change the way `future` works? It seems like `future` is not widely used at all. If this is the case, perhaps we might be free to improve it. 3. How can we properly test errors signalled by a future send, if it pops up a debugger that we can't suppress? See the changeset's PromiseTest>>testFutureRejection, which currently has to be an expectedFailure for this reason. Tony FuturePromiseErrorHandling.1.cs (4K) Download Attachment |
I would prefer to see the debugger in such a case, unless the user makes use of #whenRejected: explicitely. I use future sends to perform frequent checks/tasks in the UI process. On each check, I decide whether to continue polling or not. I do not want to use Morphic alarms directly for such a case.
You can avoid the debugger in the case of MorphicProjects like this: [ 1 future / 0. "If needed, wait with a delay here." Project current world doOneCycle. ] on: ZeroDivide do: [:err | ] Best, Marcel
|
... for me, I do not see or use the promise object. It is just a regular (even if deferred) message send. Thus, the debugger should appear as usual for other message sends. Best, Marcel
|
In reply to this post by marcel.taeumel
Hi Marcel,
Thank you for the feedback! It has been helpful. I have a revised proposal (see below) and updated changeset (attached). If the updated proposal doesn't strike anyone as problematic, I'll go ahead and commit it. On 02/13/2018 02:00 PM, Marcel Taeumel wrote: > I would prefer to see the debugger in such a case, unless the user makes > use of #whenRejected: explicitely. This is a good idea. How about the following: Promise >> fulfillWith: aBlock self fulfillWith: aBlock passErrors: rejecters isEmpty ... and usage of `fulfillWith:` in the future-handling code as previously proposed, meaning that the debugger will be seen exactly when no `whenRejected:` has been sent to the Promise? That is, (1 future / 0) will make the debugger show up, but (1 future / 0) whenRejected: [] will not. In both cases, the Promise will be rejected with a ZeroDivide. > You can avoid the debugger in the case of MorphicProjects like this: [...] Ah, excellent, thank you, that works well. Now there are no failing tests and no expected failures in the tests in the changeset. Tony FuturePromiseErrorHandling.2.cs (4K) Download Attachment |
I forgot the list ... ------ Weitergeleitete Nachricht --------
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
|
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 <[hidden email]> wrote:
|
In reply to this post by marcel.taeumel
Hi Tony,
On Wed, Feb 14, 2018 at 2:36 AM, Marcel Taeumel <[hidden email]> 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. 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.
_,,,^..^,,,_ best, Eliot |
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)..
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
|
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, row">
Exception handling and concurrency (was Re: Fw: Re: [ReviewRequest 2] Error-handling and use of `future`)
Re: Raven and Squeak-E (was Re: Fw: Re: [ReviewRequest 2] Error-handling and use of `future`)
Re: Exception handling and concurrency (was Re: Fw: Re: [ReviewRequest 2] Error-handling and use of `future`)
«
Return to Squeak - Dev
|
1 view|%1 views
|