Arnaud,
I hope you heard about "locality principle" in software construction. This
principle underlines both structural and OO programming.
A programmer should be able to control side effects of any given scope if he
needs to.
--Leo
>>>>> "AM" == Arnaud Meuret <ameuret / blocks4you.com> writes:
>> Suddenly your program goes crazy because someone already introduced local
AM> 'i' in
>> one of the enclosing scopes might be 200 lines earlier and it holds some
AM> other
>> magic number like 12345. Now my innocently looking 'for' loop resets the
AM> value
>> of 'i' to 10 which is a BUG.
AM> Am I right to be shocked by some points (3) here ?
AM> What kind of collaborative programming is that ?
AM> 1) Two (at least apparently) developpers working on the same "function"
AM> (enclosing scopes)
AM> and unaware of the current set of local variables
AM> 2) A "function" (enclosing scopes) more than 200 lines big !
AM> 3) An *innocent* 'for' loop with i as iteration variable !!!!!! I didn't
AM> know such a thing existed !
AM> I suppose you might just as well write an innocently looking Hannibal
AM> Lecter !
AM> How can it be decently requested that a language protects you from such a
AM> density of Bad Things(tm) ?
AM> I am aware that local variables in ruby blocks, with possibly nested scope
AM> bindings and stuff can be tricky to handle for a newcomer BUT the quoted
AM> argument is a little bit too much.
AM> Arnaud MEURET
AM> CWS
AM> Software Architecture