[eeps] Request for comments on EEP-25 "Unnesting cases"

Geoff Cant nem@REDACTED
Sat Dec 20 17:10:36 CET 2008


I like the general idea, but am not so sure about leaving out the value
we're falling through.

case voltage() of
    high -> panic()
  ; normal -> continue_operations()
; or case status() of
  ; emergency > set_speed_slow()
  ; normal -> shut_device_down()
end

We miss the fact that the second case statement is tried when the
voltatge() is low. I can see myself 'improving' voltage() to return a
fourth value and forgetting to update this case statement.

Perhaps there's some way to specify the value to match?

case voltage() of
     high -> panic()
   ; normal -> continue_operations()
; or low case status() of
     emergency > set_speed_slow()
   ; normal -> shut_device_down()
end

Then do we allow binding as well?

case voltage() when
       {high, _V} -> panic()
     ; {normal, _V} -> continue_operations()
in     {low, Vs} 
case status() of
       emergency when Vs > 1 > set_speed_slow()
     ; emergency when Vs <= 1 > set_speed_really_slow()
     ; normal -> shut_device_down()
end

I can't quite come up with a syntax for this I really like - it'd be
ideal if voltage() and status() could naturally start at the same
column. The case clause patterns should also align.

I like that this EEP reduces the need for hard to read nested case
statements, but I don't like that in its current form the EEP requires
me to give up explicit case clauses in order to use it.

Cheers,
-- 
Geoff Cant




More information about the eeps mailing list