[squeak-dev] OutOfScopeNotification
Eliot Miranda
eliot.miranda at gmail.com
Wed Sep 8 02:08:45 UTC 2010
On Tue, Sep 7, 2010 at 1:07 PM, Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com> wrote:
> About http://bugs.squeak.org/view.php?id=3448, the visible
> consequences are fixed by introduction of closure, but...
>
> Can someone explain why should ParagraphEditor & al catch
> OutOfScopeNotification at all ?
>
Looking at the Mantis case I'd say it was obsolete and ideally we would nuke
the entire class and its uses, but we need to change the part of
Encoder>>#encodeVariable:sourceRange:ifUnknown: that says
(varNode isTemp and: [varNode scope < 0]) ifTrue:
[^OutOfScopeNotification signal
ifTrue: [action value]
ifFalse: [self notify: 'out of scope']].
to "do the right thing". This isn't the right thing:
(varNode isTemp and: [varNode scope < 0]) ifTrue:
[^action value].
Because for an out-of-scope temp this will cause a raise of an
UndeclaredVariableWarning, which is wrong, which if uncaught will result in
a notification of "Undeclared", which is misleading.
Instead one fix might be to change Encoder>>encodeVariable: name to
something like
Encoder>>encodeVariable: name
^self encodeVariable: name
sourceRange: nil
ifOutOfScope:
[:nodeOrNil|
nodeOrNil
ifNil: [self undeclared: name]
ifNotNil: [self assert: (nodeOrNil isTemp and: [nodeOrNil scope < 0]).
requestor notify: (nodeOrNil isArg ifTrue: ['block arg'] ifFalse:
['temp']),
' is out of scope']]
rename Encoder>>#encodeVariable:sourceRange:ifUnknown:
to Encoder>>#encodeVariable:sourceRange:ifOutOfScope: and have it pass in
either nil or the out-of-scope temp.
What would you do?
best,
Eliot
>
> Nicolas
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100907/5153bb18/attachment.htm
More information about the Squeak-dev
mailing list
|