[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Say No to global-by-default
- From: Jakub Jirutka <jakub@...>
- Date: Wed, 4 Jul 2018 22:43:19 +0200
>> When you want to determine whether this variable is global or not, you
> have to search for global-declaration-statement that may be located far
> from the current line.
>
> That sounds as if that were something of utmost importance. But, again,
> why is that more important than having to decide whether a given local
> is an upvalue, or a plain local, or whether it eclipses another local?
> Also, see above re naming schemes.
Global may be declare absolutely anywhere - in a different file or even
third-party library. That's the problem, this very wide scope. Plain
local has well defined lexical scope, in the worst case one file.
upvalue is limited just to a function.
If you ignore this very important difference and say that it's the same
issue, then the whole discussion is pointless...
Jakub
On 04/07/18 22:31, Viacheslav Usov wrote:
> On Wed, Jul 4, 2018 at 10:10 PM Egor Skriptunoff
> <egor.skriptunoff@gmail.com <mailto:egor.skriptunoff@gmail.com>> wrote:
>
>> Or did you mean "$ is ugly because it looks too Perl/PHP-ish"? :-)
>> Does "@" look more esthetically than "$"?
>
> I am not a believer in Hungarian notation. Making it part of any
> language is the silliest thing I could think about. Give me as few
> restrictions as possible on identifiers and if I feel I need a naming
> scheme, I can create one myself, thank you very much.
>
>> Declaring each used global in special global-declaration-statement is
> boring.
>
> You could substitute 'local' for 'global in your statement, and it would
> be equally pointless. What is more, your proposal is squarely about
> declaring each and every global. But why should it be easier to declare
> globals than locals?
>
> Any code that needs a large number of globals is suspect unless there
> are special circumstances warranting that; if that is the case, not
> local = implicit.
>
>> When you want to determine whether this variable is global or not, you
> have to search for global-declaration-statement that may be located far
> from the current line.
>
> That sounds as if that were something of utmost importance. But, again,
> why is that more important than having to decide whether a given local
> is an upvalue, or a plain local, or whether it eclipses another local?
> Also, see above re naming schemes.
>
> Cheers,
> V.