For Each Anomaly
Björnke von Gierke
bvg at mac.com
Wed Jun 20 10:56:48 CDT 2007
On 20 Jun 2007, at 16:20, Jim Ault wrote:
> On 6/19/07 9:40 PM, "Björnke von Gierke" <bvg at mac.com> wrote:
>> This is looking completely wrong at the issue. A variable should be
>> changeable, it's in the definition of the name. If a variable is not
>> changeable it should be renamed to "constant" or maybe
> Variable means that it can be defined, but not necessarily at any
> time to
> any value.
Maybe to the professional uber geek. Every other person will tell you
that variable in this context is the same as changeable. Of course you
could argue that variable could mean erratic, as in unpredictably
changing, but I'm sure you wouldn't want a language that depends on
such a definition either.
> In any programming language, or scripting language, the term 'variable'
> comes with the discipline of 'type casting', which means not all
> are the same, or same type, or serve the same purpose.
Don't make me take out the dreaded "everyone jumps out of the
> Here (the number of lines in field " colorsList") is evaluated before
> deletions, and Rev does not stop to re-evaluate. Of course, this loop
> generate an error as soon as there is no "line x" because of deletions.
You talk about a similar problem with repeat with x = y to z, and yes
you make a valid argument to change the behaviour for that loop too.
> Some uses of variable definitions work faster and better if they are
> then not changed, or allowed to be changed. I prefer to have the speed
> offered by 'repeat for each' than have it changed to a method that
> constant rechecking of the value of a 'variable'.
> If Rev does this, I would hope they clearly label it to be different
> repeat more slowly for each line LNN in myVar
> end repeat
This is the only valid argument you have put forth. Speed is important,
but again, if it is not changeable, no one should be able to change at
all, and therefore it should be a constant, and not a variable.
I could live with your proposed nomenclature, and would put forth this
for the existing loop:
constant myConstant = myVar
repeat for each line with constant LNN in myConstant
> Basically, I like it the way it is, and it is part of the definition.
No, it is part of the rules, and rules are only applied when there are
uncertainty. Having the reason for rules removed is far more rewarding
then patching them with clunky workarounds.
Again for the general public, and not the experts
More information about the use-livecode