Re: For loops

new topic     » goto parent     » topic index » view thread      » older message » newer message

CChris wrote:
> 
> here would be my proposal for changes/extensions:
> 1/ Change to the for loop semantics
> 2/ New construct
> 3/ Change in ex.err dumps

So what you are saying, by 1/ and 3/ alone, is that:
for i=1 to 10 do end for
    ?i
    for i=1 to 5 do end for
    ?9/0

runs without compilation error, displaying 11 and creating an ex.err with just
the one i (=6) in it, right?

Now, when the compiler encounters the for i=1 to 5 statement, it must be doing
one of two things:
  a) hiding the previous i and creating a new one, or
  b) re-using that i
In both cases the i must be specially marked as "from a for loop" I take it?
(and also "the end for has been found and processed")

You will also need special handling in this top-level case:
for i=1 to 5 do end for
integer i

Again options a) and b) both seem equally plausible.

Option a) makes the plans for ex.err rather tricky whereas b) means that no
change whatsoever to ex.err creation is required. Obviously therefore b) is the
sensible thing to do, right?

If you are going to make the changes for 1/ and 3/, they solve all the problems
on their own, and proposal 2/ becomes utterly pointless.

Regards,
Pete

PS It does not strike me as particularly logical that i cannot be assigned to
after the end for, but it is a compromise I can easily accept.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu