On 2009-Feb-23, at 10:09 am, TSa wrote:
I also think that time and numbers in general should be treated in
a fuzzy way by smart match.

My thought is to have == take a :within adverb, at least for imprecise types like Num, that could be used to specify how close values need to come in order to be considered equal.

So instead of:
    if abs($x-$y)<$epsilon { ... }

you could say:
    if $x==$y :within($epsilon) { ... }

which makes your tests for equality look like tests for equality.

I'd even suggest that the :within be mandatory, to guarantee that the coder is aware that "$x==$y" is probably not DWIM. Of course, there should also be an easy way to set epsilon across a scope, like:

    use Num :precision(0);    # force exact matches in this block


Reply via email to