On Fri, Aug 17, 2012 at 08:42:35PM -0400, Ricardo Signes wrote: > * Abigail <abigail@abigail.be> [2012-08-17T09:24:10] > > For me, one of the few advantages I saw in using ~~ is not having to > > wonder when to use == vs eq vs =~. The above table suggests that > > > > "0.0" ~~ 0 > > > > is false, while it's currently true. That bothers me. IMO, a "smart match" > > should be able to say, "hmmm, both my operands look like numbers, you know > > what, I'll use '==' to compare them!" > > > > Would this be workable: > > > > $a $b Meaning > > ======= ======= ====================== > > [...] > > Any Looks like number $a == $b (without a "isn't numeric" warning) > > Any Simple $a eq $b > > Any Any fatal > > [...] > > This is similar to something Damian suggested, which was == if both $a *and* $b > look_like_number. I think that's less jarring to me, as I think I'd expect > ("foo" ~~ "0e0") to fail. > > What do you think? Yeah, I initially wanted to propose (LLN == looks like a number): LLN LLN $a == $b !LLN LLN false LLN !LLN false and then thought "ah, but the last two are redundant, they will fall back to 'eq', and that will return false anyway". And then I returned the remaining case into 'Any LLN', forgetting about the oddity that when something doesn't look a like a number, we treat it as 0. So, yeah, Damian is right, '==' should be used iff both sides look like numbers. That was my intention as well, but there were some bad transmissions errors between my brain and the email that I send. AbigailThread Previous | Thread Next