On Tue, 16 Dec 2008, Jon Lang wrote:
How do you compute '*'? That is, how do you know how many more
iterations you have to go before you're done?
In some cases, it won't have to be computed, in some cases it won't be
computeable (which should be an error). I'd say it'd be fair enough to say
that 1..(*-1) should be an error in non-bounded(?) loops (ie. while). Just
figure things out when we can, and when we can't, give an error.
Should you really be handling this sort of thing through an "iteration
count" mechanism? How do you keep track of which iteration you're on?
Is it another detail that needs to be handled behind the scenes, or
is the index of the current iteration available to the programmer?
(Remember, we're dealing with 'while' and 'loop' as well as 'for'.)
I'd say track it if necessary, kinda like the regex variables in Perl5
that imposed a performance hit. Have a magic variable that tracks the loop
count if:
- The variable is referred to anywhere
- Any of the NEXTs require it
It seems like the NEXT queue I suggested is already specced (although
without the iterator count thingies).
I'm also starting to wonder what we do with the return values of the
NEXT blocks :).
:)
---------------------------------------------------------------------
| Name: Tim Nelson | Because the Creator is, |
| E-mail: wayl...@wayland.id.au | I am |
---------------------------------------------------------------------
----BEGIN GEEK CODE BLOCK----
Version 3.12
GCS d+++ s+: a- C++$ U+++$ P+++$ L+++ E- W+ N+ w--- V-
PE(+) Y+>++ PGP->+++ R(+) !tv b++ DI++++ D G+ e++>++++ h! y-
-----END GEEK CODE BLOCK-----