For Each Anomaly

Mark Smith mark at maseurope.net
Wed Jun 20 17:19:53 EDT 2007


On 20 Jun 2007, at 20:37, Björnke von Gierke wrote:
> "Adding description for every unexpected behaviour is like trying  
> to prevent a breach in a dyke by explaining to the water that it  
> should go somewhere else. If the language would behave as expected,  
> there would be less airquote & bug & airquote reports immediately  
> (and less breaking dykes)."


Björnke, what you suggest would mean that the 'constant' keyword  
would then have a context-dependent meaning - needing a description  
of unexpected behaviour, so like many problems in life, it would be  
like trying to squash a balloon!

Also, consider that if interfering with the loop variable did not  
affect the loop, that would make 'repeat for each' a special case -  
also requiring a special description.

It's actually very simple : if you mess with loop variables, you will  
affect loop behaviour. This is not a hard idea to grasp, and  
ceratinly no harder than it is to grasp the idea of loops themselves.


> You ask any non programmer who would like his own custom program,  
> why they do not use programming languages.

Once you've rolled up your sleeves and started writing code (in any  
language), are you a programmer or a non-progammer?

> Then think about how to change rev to make it easier for these people.

Ease of use is undoubtedly one of Rev's strengths, but remember that  
it's also used by professional developers, for whom speed of  
execution may be important (as it may be for non-professional  
developers, like me), and as I say, learning not to mess with loop  
variables is really not one of the harder lessons to learn in any  
language.

FWIW, when I first came to Rev from Hypercard, I also made this  
mistake, and resisted using the 'repeat for each' form until some  
kind soul on this list explained that the "LNN" in "repeat for each  
line LNN in someList" is indeed a loop variable, just like the "n" in  
"repeat with n = 1 to 20". Then I understood, and was able to boost  
the speed of my handlers by a large factor...

Best,

Mark


More information about the use-livecode mailing list