Re: What's new in 2.5?

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

Christian Cuvier wrote:

> With the proposed ifx, the alternative is more palatable:
> - If failure to evaluate translating as false is correct, you won't have to 
> code a test the interpreter performs anyway: clearer code, less bugs, a few 
> cycles less.
> 
> - If it is not, then the issue raised in the snip was that it would allow some
>
> bugs to go unnoticed. Sure, the failure to evaluate will not crash the ifx 
> statement, but it will crash another one nearby.
> 
> Bottom line: you don't lose coding security, and you spare some coding, 
> getting clearer code. That was the point.
> 
> Btw, this scheme extends beyond out of range indexes. "ifx sqrt(x)=y then..." 
> would just be a false conditional if x=-1.

Perhaps I don't understand this, but aren't you talking about something 
which should really be handled with a try...catch type of construct?

In your example 
if s[i+3] < 3 then

you say that, given a sequence with 3 items, reading beyond the end 
of the sequence should return false.

My exmaple:
s = {TRUE, FALSE, TRUE}
if s[4] then ....

Returning either FALSE or TRUE for s[4] would be a very big mistake,
with possible major repercussions. 

Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu