Re: New Switch Idea

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

Derek,


What I meant by "case <value> then" is:

switch X do 
  case 1 then 
    -- do something 
  case 2 then 
    -- do something else 
  case 3,4,5 then 
    -- do something else 
end switch 

removing the : all together. The above seems much more euphorian to me.


Using "on" vs. "do" ... I think your right. It sounds good, but switch X do is not hard to comprehend either. Another keyword would me we can't have a flag on = TRUE, however, on would be a bad variable name anyway... on what? light_on, fan_on, would be better.


Case list. If a case list is not hard to implement and will not cause further delays, then there is no reason on putting it off until 4.1. While we are making these changes to switch, just change that too. My only concern is that we may decide to do something different with it in the future and will then have this baggage to live with. I cannot think of anything, but I only thought for a short time. Would we ever want a case statement to do other things that the list format would conflict with?

I do like the case list better:

switch X do 
    case 1: 
    case 2: 
    case 3: 
      -- 1, 2 or 3 
    case 1,2,3: 
      -- 1, 2 or 3 
end switch 

Jeremy

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

Search



Quick Links

User menu

Not signed in.

Misc Menu