[squeak-dev] the semantics of SyntaxErrorNotification resume:

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Fri Apr 16 18:35:35 UTC 2021


Hi all,
I see some new tests failing
- testResumeEarlySyntaxError
- testResumeLateSyntaxError

This is entirely my fault because of the "fix" of exception handling.
Indeed, I have not rearmed the exception stack in resume: action, and
I think I should have done so.

However, I see that SyntaxErrorNotification>>resume: launch a new
compilation entirely.
This sounds un-necessary to me because we already have
ReparseAfterSourceEditing for that purpose...
(again I'm the original author of that, Christoph only improved it)

IMO, the purpose is not really to resume: but rather to retry
compilation using newSource.
We (I ?) have used resume: only because notify:at: does signal a
SyntaxErrorNotification, then immediately retries if the exception
resumes.

    (notification := SyntaxErrorNotification
                cue: (cue copy
                    source: (source contents asText
                        copyReplaceFrom: location
                        to: location - 1
                        with: messageText);
                    yourself)
                doitFlag: doitFlag
                errorMessage: string
                location: location) signal.
            notification tryNewSourceIfAvailable

But if the handler does retryWithNewSource: newSource instead of
resume: newSource, then we just have to let retryWithNewSource perform
a self resignalAs: ReparseAfterSourceEditing new.

I think that it's the right solution, rather than bending the
semantics of resume: (the argument of resume: is normally the value
that should be returned to the sender of signal...).

So if you see some changes of SyntaxErrorNotification in trunk, you'll
know a bit more about it
(I'm not sure whether I can redact a commit message with that level of
explanation).

Nicolas


More information about the Squeak-dev mailing list