Here's the next part to the Control Structures message I sent before.  

        The next part is to apply the same idea to loop.  Please note that 
this syntax conflicts with stuff already in Perl, but it's a bit clearer what 
I mean when I do it this way; the question is, do we scrap my idea, or the 
other syntax?  :)

        I'll begin with a few words of explanation of what follows.  First, 
you normally wouldn't spread it out this much.  Second, each line is 
optional, except "loop" and { blockL }.  

----------------------------------------------------------------------
loop
        parallel
        first { BLOCKF }
        each [ actual ] [ $key [ => $value ] ] (@array|%hash)
        while ( EXPR )
        count [ $autocount ] [ ($start, $end, $step) ]
        nest { BLOCKT }
        { BLOCKL }
        next { BLOCKX }
        all { BLOCKA }
        any { BLOCKB }
        some { BLOCKS }
        none { BLOCKN }
----------------------------------------------------------------------

        Anyway, in this one, the loop can function as anything.  I'm calling 
the each, while, and count lines "iterator sections".  

each: 
        "each" takes top priority.  If it's present, the loop goes around 
@array.end times.  The "actual" means that if you modify $_ (or $key, or 
whatever), then it modifies the array element too.  

while:
        If while is present it gets evaluated each time the loop goes around.  
It takes second priority to each.  If there is no each present, then when the 
while is false, the loop exists.  If there's an each present, the status of 
the while expr only affects the $truecount and $falsecount variables.  

count:
        The count section sets the automatic counter variable, and the 
parameters of the count.  $start defaults to 0.  $end defaults to infinity.  
$step also defaults to 1.  If the count reaches $end, but there is a while or 
an each, then the autocount stops incrementing, but the loop keeps going.  

nest:
        Nest is the power loop thingy documented in Raphael Finkel's top notch 
book "Advanced Programming Language Design", near the end of the "Control 
Structures" chapter -- this book is in PDF format:
http://www.nondot.org/sabre/Mirrored/AdvProgLangDesign/

post-loop structures:
        The all|any|some|none set work exactly the same way as with the given 
statement; they are based on the values of $truecount and $falsecount.  

        Anyway, I hope this makes sense.  

        :)

---------------------------------------------------------------------
| Name: Tim Nelson                 | Because the Creator is,        |
| E-mail: [EMAIL PROTECTED] | I am                           |
---------------------------------------------------------------------

----BEGIN GEEK CODE BLOCK----
Version 3.1
GCS d? s: a-- C++>++++$ US+ P++ L++ E- W+++ N+ w+> M-- V- Y+>++ 
PGP->++ R(+) !tv B++ DI++++ D+ G e>++ h!/* y-
-----END GEEK CODE BLOCK-----


Reply via email to