A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-mt.1390.mcz ==================== Summary ==================== Name: Kernel-mt.1390 Author: mt Time: 19 April 2021, 5:47:51.865053 pm UUID: c36ac126-16de-3d41-be90-6b7fd46bc0c7 Ancestors: Kernel-nice.1389 Proposal. Better support for hot code updates by restarting from a denoted (i.e. domain-specific) context (or active method). For example, this could be used to better update the McmUpdater as soon as a code change in itself is detected. Two options: either mark the restart context with an on:do: handler or process a query to look up that context such as by package name. =============== Diff against Kernel-nice.1389 =============== Item was added: + Notification subclass: #RestartContextRequest + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'Kernel-Exceptions'! Item was added: + ----- Method: RestartContextRequest class>>fromContextSuchThat: (in category 'as yet unclassified') ----- + fromContextSuchThat: block + "Use this to restart from an arbitrary context on the stack." + + | context | + context := thisContext sender. + [context notNil] whileTrue: [ + (block value: context) ifTrue: [ + ^ self new restartFrom: context]. + context := context sender]. + self error: 'No context found!!'.! Item was added: + ----- Method: RestartContextRequest>>restartFrom: (in category 'as yet unclassified') ----- + restartFrom: aContext + + | process actualContext unwindError | + aContext ifNil: [^ self error: 'No context to restart!!']. + + process := Processor activeProcess. + + [actualContext := process popTo: aContext. + unwindError := actualContext ~= aContext. + unwindError + ifTrue: [process resume] + ifFalse: [process restartTop; stepToSendOrReturn; resume] + ] fork. + + process suspend.! Item was added: + ----- Method: RestartContextRequest>>restartFromHere (in category 'as yet unclassified') ----- + restartFromHere + "Use this to restart from an exception handler." + self restartFrom: handlerContext.! |
Here are the two options in an exapmle:
|
Hi, Sounds like a step towards restarts as found in Common Lisp, which I like. Do I understand correctly that you denote the point of restart with #restartFromHere (where "here" is a bit misleading since it is written in a different block) and that you trigger the restart with RestartContextRequest signal? And #fromContextSuchThat: does both? Now we would just need the possibility to give the restart context a logical identifier (a name, a purpose), and the UI to interactively choose from those identifiers that are on the stack; then we have a higher-level error recovery tool or a mightier debugger notifier. For API, the equivalent would be a specialization of fromContextSuchThat:, which selects from those identifiers. "Proceed" and "Abandon" are special cases with implicit restart contexts: with everything left on the stack, and with nothing left on the stack, respectively. Kind regards, Jakob Am Mo., 19. Apr. 2021 um 17:50 Uhr schrieb Marcel Taeumel <[hidden email]>:
|
In reply to this post by marcel.taeumel
Hi Marcel,
these are interesting concepts though hard to evaluate without real-world examples, I guess. But it does seem to be a crucial core concept to me. Maybe this would better fit into the System package? I'd like to keep the Kernel package as small as possible and this one is rather advanced stuff ... 😊 Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 19. April 2021 17:50:02 An: squeak-dev Betreff: Re: [squeak-dev] The Inbox: Kernel-mt.1390.mcz
Here are the two options in an exapmle:
Carpe Squeak!
|
Real world example use cases if we had the Common Lisp experience: Try to install something via Metacello. Metacello would register "retry" restarts before downloading a package. The download of the last of dozens of packages fails three times, so Metacello errs out, you get a debugger notifier. You would click on "retry" to restart the package download instead of seeking out the correct context for that (requires Metacello knowledge), or instead of restarting the whole installation, which would needlessly repeat the dependency resolution up to the failed package. Similar: when hitting the "Connection closed" error after pushing to GitHub from the Git Browser, retry the upload without computing the set of commits and compiling the pack file again... I guess with extra (domain-specific) message box programming, this would already be feasible now: 1. Register upload error handler that prompts for retrying (GUI layer). 2. Compute the file to be uploaded. (3. Register restart context for upload retry.) 4. Register handler for Connection closed error; the handler will signal upload error. 5. Attempt upload, which hits Connection closed. 6. Gets handled, signals upload error for the GUI. 7. Gets handled, GUI prompts whether to retry. 8. User chooses "Yes", GUI lets resume from upload error with that choice. 9. Connection closed handler receives this choice, restarts from the retry context. With the extra mile UI stuff in the debugger/notifier, one would not need to write domain code for the steps 1, 4, 6, 7, 8, 9. So the only additional code would be registering the restart context (with a nice description text). Am So., 25. Apr. 2021 um 20:05 Uhr schrieb Thiede, Christoph <[hidden email]>:
|
Hi Jabob, hi Christoph, thanks for sharing your thoughts. As mentioned in the commit message, the primary example would be restarting the McmUpdater if it updated itself at some point. This is not possible at the moment, which renders it impossible to reliably change code in there for all images out there. If approved and polished, such a mechanism belongs into Kernel because it extends process/context management below the tool level. Or at least where Process, Context, and Exceptions are. :-D ... I think. If that would be too advanced for Kernel, then, I suppose Exceptions are, too. ;-) (Another perspective on this is a scriptable version of what the debugger can do with its buttons already.) Best, Marcel
|
Hi Marcel,
EHS belongs into the Kernel, of course. But I'm not convinced yet that your proposal is an essential component of the EHS. :-) "Abort" is in System-Exceptions, too. Von: Squeak-dev <[hidden email]> im Auftrag von Taeumel, Marcel
Gesendet: Montag, 26. April 2021 17:15:48 An: squeak-dev Betreff: Re: [squeak-dev] The Inbox: Kernel-mt.1390.mcz
Hi Jabob, hi Christoph,
thanks for sharing your thoughts.
As mentioned in the commit message, the primary example would be restarting the McmUpdater if it updated itself at some point. This is not possible at the moment, which renders it impossible to reliably change code in there for all images out there.
If approved and polished, such a mechanism belongs into Kernel because it extends process/context management below the tool level. Or at least where Process, Context, and Exceptions are. :-D ... I think. If that would be too advanced for Kernel, then,
I suppose Exceptions are, too. ;-)
(Another perspective on this is a scriptable version of what the debugger can do with its buttons already.)
Best,
Marcel
Carpe Squeak!
|
Free forum by Nabble | Edit this page |