Lots of people said:
>Lots of stuff about 'else' loops.

*Erik thunks himself some deep thought*

I see no true slippery slope here, especially if handled correctly. I suspect that an 
explicit or implicit "why not" near the beginning of discussion lead to the feature 
feeding frenzy and the slippery slope responses.

To my thinking, assuming this is a needed feature, the ELSE block method is not quite 
adequate. We are approaching the limit to the number of implicit blocks within control 
structures a mind can be reasonably expected to handle. Although we have made comments 
on the placement of these blocks being hapahzard as is, there isn't necessarily a 
clear position within the flow of code that is associated with the concepts behind 
those blocks. 'ELSE' however seems to clearly need to be after the block to which it 
represents an alternative. Scoping issues also tend toward the post block syntax.

The need for such a structure has been most clearly defined and argued for in the case 
of 'loop'. While others have said 'I can see advantages' I generally cannot, save in 
the case of loop where the synthetic code of the flag to check if the loop was passed 
through is a hassle and not clear. Allowing a 'loop {...} else {...}' syntax seems to 
fill this niche nicely.

I have always argued that any exceptions to the looping rules should be attatched to 
while, as while already had special behavior for DWIM. Now that loop has gained this 
behavior anyway, loop seems the most deserving canidate for that reason.

Finally, scoping issues seem to have mostly to do with aliasing. While plenty of 
implicit aliasing occurs with 'loop <> {...}' explicit aliasing seems to occur with 
'foreach'. By only allowing the else construct on the control structure least likely 
to have scoping issues, it makes the learning of the syntax easier. Even if you don't 
understand them, you're less likely to run into them. As far as implicit aliasing 
goes, I think that it would be clear that the else block only executes if $_ hasn't 
been assigned to by the diamond, making it unlikely anyone would be bit by subtle bugs 
from the use of $_ in the else block. I hope :-)

So, all of these things seem to say to me that the case can be made for allowing 
'loop' to have an 'else' block, and for no other structures to, and that this clock 
should work like an if block, and not like the implicit blocks already extant.

-Erik


Is your boss reading your email? ....Probably
Keep your messages private by using Lycos Mail.
Sign up today at http://mail.lycos.com

Reply via email to