Possibly better loop construct, also labels+goto important and on the fly compiler idea.

Skybuck Flying Windows7IsOK at DreamPC2006.com
Wed Oct 16 19:44:43 EDT 2013


One final example plus further analysis to be perfectly clear what fine code 
would look like and why it's adventage:

At the bottom I come to the conclusion that the proposed loop construct with 
begin and ending conditions has merit after all ! ;) =D

LoopBegin

    if not BeginningCondition then LoopBreak

    ...Code...

    if EndingCondition then LoopBreak

LoopEnd


This gives programmer full control over if the loop should be a while loop 
or a repeat until loop.

Should it have a beginning condition ?

Should it have a ending condition ?

Both can be writting without having to change the main loop statement block:

Begin

End

Also both kind of while/repeat until functionalities can be integrated.

It also allows to seperate logics, from begin/enter and end/exit.

There is one little problem with the above code:

the not, this is still logic inversion.

It could have been written as follows

if LoopSkipCondition then LoopBreak

However that's not convenient.

Therefore this posting must conclude that a special loop construct is 
usefull:

LoopBegin( EnterCondition )

LoopEnd( ExitCondition )

This would have allowed the code above to be written as:

LoopBegin( BeginningCondition )

LoopEnd( EndingCondition )

^ No logic inversion needed.

So this construct has merit after all.

Bye,
  Skybuck.




More information about the Python-list mailing list