On Wed, Oct 7, 2015 at 10:24 AM, Dave Mitchell <davem@iabyn.com> wrote: > I think 95% of what people actually *want* a smartmatch system for is so > that they can write code of one of these three forms: > > given ($index) { > when (undef) {...} > when (0) {...} > when (1) {...} > when (INDEX_MAX) {...} > } > > given ($string) { > when (undef) {...} > when ("foo") {...} > when ("bar") {...} > when (BAZ) {...} > } > > given ($string) { > when (undef) {...} > when (/foo/) {...} > when (/bar/) {...} > } > If you are doing away with polymorphism, why squeeze these three different semantics into a single keyword? Why not let the programmer write what he means explicitly, rather than implicitly on compile-time "type"? I'm sure the maintainer would prefer (modulo obvious bikeshedding): given ($index) { when (undef) {...} ncase (0) {...} ncase (1) {...} ncase (INDEX_MAX) {...} } given ($string) { when (undef) {...} scase ("foo") {...} scase ("bar") {...} scase (BAZ) {...} } given ($string) { when (undef) {...} when (/foo/) {...} when (/bar/) {...} } … well, at least this maintainer would … EirikThread Previous | Thread Next