/.../ 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).
That conversion is so completely hidden that it's purely an implementation detail, as opposed to ints vs floats. I.e. If we should extend that reasoning to floats then there should be a type that can contain any number, and that would choose between native integer, native float and Gmp object as suitable for the internal representation.
Lisp is _very_ different from anything. On language level.
Well, I don't know what you mean with "language level", but there's a whole slew of languages that are very similar to Lisp in how types and values are handled. It's a large subset of the loosely typed languages.
/.../ it makes sense to keep equal values equal while possible. /.../
Only in cases where both integers and floats are mixed and where only their numerical properties are interesting. Those cases are fairly few compared to those where the types are just as important as their numeric values: There are many functions that behave completely differently when given a float or an integer, i.e. the type itself is used as a flag.
Not really fair. It is like comparing Chinese to English :) Lisp is _very_ different, as I said above,
Not at all. Pike is much more similar to Lisp than it is to C in several fundamental ways. It's mostly the syntax that's much more like C, and we're not discussing that here.
It seems like you're comparing Pike to strongly typed languages like C, C++ and Java. To extend your analogy, that's like comparing poetry to reference manuals, be they written in Chinese or English.
and after all it wasn't intended to do math in the first place.
I generally wouldn't want to use a language that's primarily designed to do math, since that's a very small portion of what a typical program does. Lisp was intended to do anything algorithmic, just like Pike and C.
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.
There's only a difference in degree. The primary thing in the equality operations is to treat all values and types uniformly. In that regard the numeric equivalences are comparable to those of values and their string representations.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-09-16 00:12: Subject: Re: float type weirdness
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
/ Brevbäraren