[Zpt] Built-ins and Shadows
Tim Peters
tim@digicool.com
Fri, 2 Mar 2001 11:52:22 -0500
[Todd Coram]
>> evan (Mar 2, 2001 10:54 am; Comment #7)
>> (todd's comment #6):
>>> I strongly feel that the built in names shouldn't be shadowable.
>> We seem to be outnumbered on this one, although Jim agreed that we
>> should generate lots of obnoxious warnings about shadowing of builtins.
[Todd]
> The problem with obnoxious warnings is: when do you generate them
> and where?
When, ASAP; where, I don't know (but somebody else should <wink>).
> Anyway, if shadowing isn't an error (and at the very least we say it is
> something worth issuing warnings about), we should say that the resulting
> behavior is "undefined" (in terms of the TALES specification) or
> "implementator defined".
That's a dodge taken by language committees when it's impossible to reach
consensus because a dozen vendors already implemented a thing in a dozen
conflicting ways. It's a last resort, not something to settle for at the
outset! Shadowing is extremely common-- and well-defined --behavior across
all sorts of language. Warnings are cool. The problem with errors is that
if a new builtin name is ever added, then existing code that happens to have
already used that name suddenly becomes illegal "for no reason at all" -- and
users hate that. The usual shadowing rules ensure that their code continues
to work, albeit with new warnings; much friendlier.