Re: Try/Catch

new topic     » goto parent     » topic index » view thread      » older message » newer message
Spock said...
eukat said...
Spock said...

An index error is a programming error. The programmer needs to know it to fix it.

Not necessarily. In the examples given of crashes, where a loop var is the length of a sequence, and inside the sequence the length is shortened, one could argue for the loop var not being cached. This has not been accepted by the developers of the Eu core.

.. and hopefully never will. In the meantime it remains a programming error.

Actually - speaking as a dev - I don't see a compelling reason for this to be the case.

In Dredge, I implemented a wfor loop construct, which was identical to the for loop except for three things:

It didn't define a loop variable and unscope it at the end of the loop. You had to create one yourself. The benefit of this was that when the loop ended, the last known value of the loop variable would be preserved.

The ending condition was re-evaluated each time. So for example if the length of the sequence was used as the ending condition and the sequence was shortened inside the loop, this would be detected. (The trade-off here is that the ending condition was evaluated every single time, so if the value of the condition didn't change - which would cover the majority of cases of a for loop use - it was less efficient. Also, if one used an ending condition with side effects, those side effects would be triggered on every passof the loop, instead of just once.)

You could write to the loop variable and change its value.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu