For Each Anomaly
Björnke von Gierke
bvg at mac.com
Wed Jun 20 11:56:48 EDT 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
>> "don'ttouchthisthingy".
>
> 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
> variables
> are the same, or same type, or serve the same purpose.
Don't make me take out the dreaded "everyone jumps out of the
window..." sentence.
> ...
> Here (the number of lines in field " colorsList") is evaluated before
> any
> deletions, and Rev does not stop to re-evaluate. Of course, this loop
> will
> 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
> cast,
> 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
> requires
> 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
...
end repeat
> 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
Björnke
More information about the use-livecode
mailing list