[squeak-dev] Should UndeclaredVariableWarning be a Notification?

christoph.thiede at student.hpi.uni-potsdam.de christoph.thiede at student.hpi.uni-potsdam.de
Mon Feb 7 20:25:55 UTC 2022


Thank you for the (off-list) feedback, Marcel! I have merged UndeclaredVariableNotification.1.cs to the Trunk via Compiler-ct.468/60Deprecated-ct.104/update-ct.506.mcm. :-)

Best,
Christoph

---
Sent from Squeak Inbox Talk

On 2022-01-30T21:56:59+01:00, christoph.thiede at student.hpi.uni-potsdam.de wrote:

> Alright, please take a short look at the attached changeset. :-)
> 
> Note: In the *long* term, we probably should unify this exception with UndeclaredVariable, which is a subclass of ParserNotification. But after the release. :-)
> 
> Provided no objections, I will merge this in a few days ...
> 
> Best,
> Christoph
> 
> =============== Diff ===============
> 
> Encoder>>undeclared: {encoding} ? ct 1/30/2022 21:40 (changed)
> undeclared: name 
>     | sym |
>     (requestor notNil and: [requestor interactive]) ifTrue:
>         [ requestor requestor == #error: ifTrue: [ requestor error: 'Undeclared' ].
>         ^ self notify: 'Undeclared' ].
>     "Allow knowlegeable clients to squash the undeclared warning if they want (e.g.
>      Diffing pretty printers that are simply formatting text).  As this breaks
>      compilation it should only be used by clients that want to discard the result
>      of the compilation.  To squash the warning use e.g.
>         [Compiler format: code in: class notifying: nil decorated: false]
> -             on: UndeclaredVariableWarning
> +             on: UndeclaredVariableNotification
>             do: [:ex| ex resume: false]"
>     sym := name asSymbol.
> -     ^ (UndeclaredVariableWarning new
> +     ^ (UndeclaredVariableNotification new
>         name: name
>         selector: selector
>         class: cue getClass) signal
>         ifTrue:
>             [ | undeclared |
>             undeclared := cue environment undeclared.
>             [ undeclared
>                 at: sym
>                 put: nil ]
>                 on: AttemptToWriteReadOnlyGlobal
>                 do: [ : noti | noti resume: true ].
>             self
>                 global: (undeclared associationAt: sym)
>                 name: sym ]
>         ifFalse:
>             [ self
>                 global: (Association key: sym)
>                 name: sym ]
> 
> UndeclaredVariableNotification
> + Notification subclass: #UndeclaredVariableNotification
> +     instanceVariableNames: 'name selector class'
> +     classVariableNames: ''
> +     poolDictionaries: ''
> +     category: 'Compiler-Support'
> + 
> + UndeclaredVariableNotification class 
> +     instanceVariableNames: ''
> + 
> + ""
> 
> UndeclaredVariableNotification
> + Notification subclass: #UndeclaredVariableNotification
> +     instanceVariableNames: 'name selector class'
> +     classVariableNames: ''
> +     poolDictionaries: ''
> +     category: 'Compiler-Support'
> + 
> + UndeclaredVariableNotification class 
> +     instanceVariableNames: ''
> + 
> + ""
> 
> UndeclaredVariableWarning (changed)
> - Warning subclass: #UndeclaredVariableWarning
> -     instanceVariableNames: 'name selector class'
> + UndeclaredVariableNotification subclass: #UndeclaredVariableWarning
> +     instanceVariableNames: ''
>     classVariableNames: ''
>     poolDictionaries: ''
> -     category: 'Compiler-Support'
> +     category: '60Deprecated-Compiler-Support'
> 
> UndeclaredVariableWarning class 
>     instanceVariableNames: ''
> 
> ""
> 
> UndeclaredVariableWarning class>>handles: {exceptionSelector} ? ct 1/30/2022 21:46
> + handles: exception
> + 
> +     self deprecated: 'ct: Use UndeclaredVariableNotification instead'.
> +     
> +     ^ super handles: exception
> 
> UndeclaredVariableWarning>>initialize {initialize-release} ? ct 1/30/2022 21:46
> + initialize
> + 
> +     self deprecated: 'ct: Use UndeclaredVariableNotification instead'.
> +     
> +     ^ super initialize
> 
> 
> ---
> Sent from Squeak Inbox Talk
> 
> On 2022-01-30T00:44:33+01:00, christoph.thiede at student.hpi.uni-potsdam.de wrote:
> 
> > Thank you for the feedback! Now I'm wondering whether we should also rename it when making it a simple notification. An exception that ends in Warning but does not inherit from Warning might be very confusing. On other hand, compatibility matters ... What do you think? :-)
> > 
> > Best,
> > Christoph
> > 
> > ---
> > Sent from Squeak Inbox Talk
> > 
> > On 2022-01-20T09:22:08+01:00, marcel.taeumel at hpi.de wrote:
> > 
> > > Hi Christoph --
> > > 
> > > Looking at?UndeclaredVariableWarning >> #defaultAction, that warning should actually be a simple notification (that also writes to the Transcript).
> > > 
> > > Best,
> > > Marcel
> > > Am 20.01.2022 01:31:50 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>:
> > > Hi all,
> > > 
> > > since SUnit-ct.129 (treat warnings in tests as test error), we have plenty failing compiler tests. I have also noticed similar effects in some third-party packages because no one would have assumed that a simple compilation request that has no visible side effect to the user (except for a Transcript send, but who is having a transcript open all the time? me not!) could be raising a Warning. UndeclaredVariableWarning is an untypical subclass of Warning because in its default action, it does not do anything interruptive.
> > > 
> > > So my question is: Do you assure that UndeclaredVariableWarning should be Warning? In this case I will move on and handle this exception in all affected tests.
> > > 
> > > Best,
> > > Christoph
> > > 
> > > ---
> > > Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
> > > -------------- next part --------------
> > > An HTML attachment was scrubbed...
> > > URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220120/4a4ee785/attachment.html>
> > > 
> > > 
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> > URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220130/ada64a21/attachment.html>
> > 
> > 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220130/ef6643c9/attachment-0001.html>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: UndeclaredVariableNotification.1.cs
> Type: application/octet-stream
> Size: 2457 bytes
> Desc: not available
> URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220130/ef6643c9/attachment-0001.obj>
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220207/6fa50296/attachment-0001.html>


More information about the Squeak-dev mailing list