On Mon, Oct 12, 2015 at 8:08 PM, Abigail <abigail@abigail.be> wrote: > So, 'use bigint' is something funky? > No, "==" works fine with numbers replaced by "use bigint;". > But if it turns out that we're still left with something which requires > you to know what Perl does at compile time I lost you there. Why do you say that? > and it won't play nice with modules that do constant overloading Do you have an example of a module that overrides numerical constants such that "==" doesn't work? > Perhaps we should admit defeat, and just accept that in Perl, it's > operator that determines the type of the argument(s), and not the > type of the argument(s) which determines the operation. Hence, different > named "when"s, one for each type of match. (This has already been > suggested by others). > To be clear, I don't have a problem with either approach. Bike-shedding: > > when:def {...} # !defined $_ > when:num (3) {...} # $_ == 3 > when:str ("foo") {...} # $_ eq "foo" > when:pat (/bar/) {...} # /bar/ > > when:num (3, 4, 5) {...} # $x = $_; grep {$_ == $x} 3, 4, 5 > when:str ("a", "b", "c") {...} # $x = $_; grep {$_ eq $x} "a", > "b", "c" > I'd add a way of doing an arbitrary boolean expression. Maybe "when" with no attribute? e.g. when ($_ == 3)Thread Previous | Thread Next