On Mon, Sep 15, 2003 at 05:50:02PM -0400, Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
since C has implicit conversion they compare equal there. Pike doesn't have implicit conversion, and that's a design choice. A very good one
Might be. But not really when it concerns numeric types. At least, MPI is converted to int and vice versa. There is a "hidden" conversion to MPI from integer (you may argue that this is a "property" of specific type, but anyway - it is implicit).
No, they are different in e.g. Lisp too. Lisp doesn't have implicit conversion either.
Lisp is _very_ different from anything. On language level.
the two value sets. If 1 == 1.0, 2 == 2.0, 3 == 3.0 etc then there's some point where it inevitably breaks, and that wouldn't make sense either.
But people compare numbers, and they expect some logic behind. We all know about limitations, both concerning integers and floats, but still, it makes sense to keep equal values equal while possible. And, technically, when given precision is not enough to represent specific number, the equality is broken anyway (both technicaly and numerically, the second is the consequence of the first).
That's a property of that specific operator; there's no implicit conversion anywhere.
OK, what about 1 < 2.0 then? Also property of `<? The I see no logic to add such properties for `+, `< but not to `==.
This is also exactly like Lisp (and, I suspect, a fair number of other high level languages).
Not really fair. It is like comparing Chinese to English :) Lisp is _very_ different, as I said above, and after all it wasn't intended to do math in the first place.
If == and equal() would convert between types, one could just as well argue that equal(1, "1") should be true, and equal("(<1>)", (<1>)),
Not fair again. float and int are _both_ numeric types, while numerics and strings are very different types - in this case explicit conversion is would be logical.
Regards, /Al