Re: New switch/case idea

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

At the moment we have the same situation with the return keyword. I used to just stick a return in a function to have it ignore the code below, though that would generate a warning.

With multiline coments though, do we really still need this?

Absolutely. If I'm testing something and want to quickly disable 7 blocks of code, I need the break and to force me to block comment would be a huge drain.

I disagree totally here. break can introduce bugs as it changes the logical flow of your code. You may be breaking to a place you didn't count on. When you comment the code out, you comment it out and it's gone. You know what I mean by block/multi-line comments, right?

This is now valid in Euphoria:

if TRUE then 
    a = 10 
    b = 20 
 
    -- there is some bug here, let's get rid of this code 
    /* 

    a = b * 20 
    b = c * 90 
    d = a + b / 39 
    */ 
end if 

That whole block of code is now gone from IL. It's all a comment. There is no reason to:

if TRUE then 
    a = 10 
    b = 20 
 
    -- there is some bug here, let's get rid of this code 
    --a = b * 20 
    --b = c * 90 
    --d = a + b / 39 
end if 

anymore since we have multi-line comments. A multi-line comment is much more clear, robust and much less error prone then trying to use break or goto to skip a section of code that you are testing/not testing.

Jeremy

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

Search



Quick Links

User menu

Not signed in.

Misc Menu