went through the archives about RFC22 "builtin switch statement".
didn't see any mention of this, thought I'd throw it in there to see
how it was recieved.

I was thinking that the switch statement could possibly be expanded
to also behave as an operator and not just a control statement.

i.e. the way the trinary conditional operator works:

my $final = $boolean ? $this_value_if_true : $else_this_value;

except you could do a case operator:

my $final = switch ( $val ) {
          case 0 { $zero_val;}
          case 1 { $one_val;}
          case 2 { $two_val;}
          case 3 { $three_val;}
     };

why?

because the Verilog language has the same limitation
(a conditional operator but only a case statement)
and suggestions to the next version of Verilog
include adding a case operator.

thought maybe perl could learn from that mistake
before it actually ships.

also, while I'm at it, just how difficult would it be
to add the conditional operator to the operators
that can be overloaded by "use overload;" ???

(and the case operator if that were to exist)

Greg London






Reply via email to