Ok, one last answer before I do something useful...
I don't like the idea of arbitrary (compiler/interpreter decision) conversion between numeric types in case when performance matters.
We've discussed this topic before with you. A compiler/interpreter decision is not arbitrary but rule based. If you know the rules you know exactly what happens. Pike is however a high level language, which means that you should not need to learn the rules in normal cases. The goal for us as developers of the langauge Pike is to make the rules soo good that developers in Pike never faces a situation where it is needed to learn the underlying rules.
Ints are faster than floats, but floats are fast enough too, while Gmp objects are extremely slow comparing to both ints/floats.
This is true if you own an Atari. Modern CPUs has a floating point operation pipeline right next to the integer one.
Actually, even implicit bignums in Pike slow down things significantly -
That has never been under dispute. Of course bignums are slower; they perform a larger task.
Even Touring computer can do everything
It's Turing machine, after Alan Turing.
Same with Lisp - it is good for specific, but not general programming, especially for (former) C programmers (while Pike is promoted as "similar to C/C++").
There is no problem in using Lisp for general programming. I made a multithreaded, object oriented adventure game in Lisp once. Someone else made emacs. That is however beside the point. You can't convince us that Pike isn't a lot like Lisp.
Not at all. Pike is much more similar to Lisp than it is to C in several fundamental ways.
For instance?
Typed values. Garbage collection. Neither is in C++.
Two numeric types are also comparable if we won't take precision into account. Actually, the only difference between int and float is exactly the "floating point", managed by exponent part, but this is implementation detail.
Am I right in that you don't know how IEEE floating point numbers are actually represented, technically?
/ Martin Nilsson (saturator)
Previous text:
2003-09-16 02:06: Subject: Re: float type weirdness
On Mon, Sep 15, 2003 at 07:25:01PM -0400, Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
contain any number, and that would choose between native integer, native float and Gmp object as suitable for the internal representation.
I don't like the idea of arbitrary (compiler/interpreter decision) conversion between numeric types in case when performance matters.
Ints are faster than floats, but floats are fast enough too, while Gmp objects are extremely slow comparing to both ints/floats.
Actually, even implicit bignums in Pike slow down things significantly - just compare execution time for sscanf("\x80\0\0\0", "%4c", n) and sscanf("\x7f\0\0\0", n) where n is an int - and this is typical operation when IP numbers processing is necessary. Multiply this by millions - you will see the difference.
whole slew of languages that are very similar to Lisp in how types and values are handled.
(programming) languages are tuned for specific tasks. Even Touring computer can do everything, but I don't see anyone who uses this. Same with Lisp - it is good for specific, but not general programming, especially for (former) C programmers (while Pike is promoted as "similar to C/C++").
numeric values: There are many functions that behave completely differently when given a float or an integer, i.e. the type itself is
This is a bad idea by itself - the type of numeric value should not be used as a flag, IMHO - it leads to mistakes for beginners and mystical behavior when arguments are mistyped/mispassed. The function may behave differently if it concerns return value, but if it involves something else - this is EvilThing (r) :)
Not at all. Pike is much more similar to Lisp than it is to C in several fundamental ways.
For instance? Sure you can find a lot of similarity between Pike and Lisp, but this is true for C++ and Lisp as well. Pike is developed as general purpose language (at least now), or?
It seems like you're comparing Pike to strongly typed languages like C, C++ and Java.
Not really. I like the idea of types in general, but I dislike the idea of strict (strongly) types. At least, it would be nice to have pragma or something like that to control this. BTW, what about floats/ints in Java? Is those types so different there as well?
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
True, but it is nice to have a language which is well suited for math too, but still is general purpose. Pike could be the one.
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.
String may represent something that may not be converted (or interpreted) as numeric value, while numeric value may always be represented as string
- that's why it makes no sense to blindly (or uniformly) compare strings
and numerics.
Two numeric types are also comparable if we won't take precision into account. Actually, the only difference between int and float is exactly the "floating point", managed by exponent part, but this is implementation detail. They both are _numeric_ types - this is important.
Regards, /Al
/ Brevbäraren