[squeak-dev] Should we have a ShadowedVariableWarning?

Marcel Taeumel marcel.taeumel at hpi.de
Thu Jan 20 08:29:18 UTC 2022

Hi Christoph --

Encoder >> #warnAboutShadowed: currently does things similar to UndeclaredVariableWarning >> #defaultAction.

+1 for adding ShadowedVariableWarning similar to UndeclaredVariableWarning

Please let's postpone that discussion about new preferences to explicitly warn users about such things to after the 6.0 release. I think it is as useful as DeprecationWarning.

Am 20.01.2022 01:51:22 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>:
Quick follow-up from the UndeclaredVariableWarning thread, but I think this one deserves a separate discussion: Should we also have a ShadowedVariableWarning?

We have been having some recent troubles around shadowed variables in Trunk packages [1,2,3,4,5,6,*], which are not noticed by most people, disliked by many people, and sometimes intended by other people. In particular, this introduces the risk of ping-pong contributions because our coding styles are not incorporated into the system. My tl;dr from all the referenced threads is that we do not have found any consensus on the general use of shadows, but at least do not want to see them in Trunk packages.

Maybe an interactive notification for these shadows, similar to UndefinedVariable et al., would be a better solution? This would at least improve the ability for custom handling of shadows in different projects and environments.

I further propose that we introduce a new preference #warnAboutInstVarShadows, analogously to the existing ones on Scanner, and turn it off in the Trunk by default. In a later step, all these scanner preferences could be made customizable via a per-package rule mechanism.

Please note that these are two indepent proposals; ShadowedVariableWarning and #warnAboutInstVarShadows. :-)


[1] Regex-Core-ct.76
[2] Tools-eem.1065
[3] http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-September/216425.html
[4] Tools-eem.1064.mcz
[5] FFI-Kernel-mt.189, FFI-Kernel.terf-eem.188, FFI-Pools-mt.31, FFI-Kernel-mt.175
[6] http://lists.squeakfoundation.org/pipermail/squeak-dev/2021-April/214730.html
[*] Just look them up in Squeak Inbox Talk yourself. :-) ["sit shadow search.png"]

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/677c5798/attachment.html>

More information about the Squeak-dev mailing list