[squeak-dev] wrt debugger flexibility
drurowin at gmail.com
Tue Nov 29 03:45:32 UTC 2022
Christoph (and anyone else with this reaction),
On 11/28/22 17:30, Thiede, Christoph wrote:
> Squeak Exceptions have a resumption mechanism. See Exception>>#resume:, or ProvideAnswerNotification and BlockClosure>>#valueSupplyingAnswers: for a common example.
The name RESTART took me a couple tries to figure out. Obviously, there
is a #resume: function in the exception system. I like 'restart normal
evaluation after handling an exception' better, but it doesn't roll off
the tongue, and I didn't write the Common Lisp spec, so we're stuck with it.
Let me see if I can explain it better than ice cream sundaes with
Jakob's download example...
~ ~ ~ ~ ~ ~
The short version: exception handlers let signallers talk to callers,
and restarts let the callers talk back.
~ ~ ~ ~ ~ ~
You write a package that downloads a file. The download can fail, so
what should you have the package do? Some users want to give up, others
try again, and even others resume it where it left off, so which option
do you pick?
All three, of course!
There's a method that knows how far into the download it's gotten. From
there you offer 'Resume Download' that works the HTTP 2 magic. Maybe
the internet had a hiccup. Maybe your cat sat on your laptop lid
because she learned you need what's on the bottom and she wants
attention. But first you need to reopen the TCP socket.
We all know Abandon. Abandon is provided for you. But there's another
Abandon: if you're loading that download into an instance and the user
wants to 'Abandon Loading' you null out whatever incomplete state you
were building so that some later check will see, 'Ya... this is null...
It never got fetched.' and not 'What is ''828734t9tg9g9ubiuviub3r''?...'.
Then comes Retry. In a different package that works with git, the user
sees the reason it failed is they missed the last character during
copy-paste. After a duh moment they change the URL and tell it to try
that again. Just like Abandon, there are also two Retry options. 'Is
it plugged in?' is an amazing question... no wonder it didn't work!
Restarts are all about giving those options. That's why I named the
message #on:OFFER:. It's an offer of some action to take. What's
more, since these options cause branches in different methods... in
different packages... and might be at the whim of the person in front of
the screen... they go beyond the capabilities of only condition handlers.
Sadly, that's more complicated than making a yummy ice cream sundae, but
it's a good use case.
> There is no UI integration for this, yet. However, this idea already has been mentioned on the list earlier, this would definitely be a sweet feature.Two sweets is better than, 'Oh yea... Trait...'. ;3
More information about the Squeak-dev