This is ridiculous

Notices and updates
konrad
Posts: 11
Joined: Thu Aug 23, 2007 4:05 pm

Post by konrad »

(4) Integer and Float Arithmetik
You can redefine the integer operators (see manual) and then you get just the same number treatment you have in other scripting languages.
This is about the only critisism I would agree with. + - etc should be smarter. And by smarter I don't meen should return floats at is as dump as always casting to an integer. Having spend a long time in Python probably gives me some Bias. but havign arithmatic operators which do things in Integer mode if you give them integers and in float mode if you give them floats seems to be the best alerantive.

In Python (yes I'm comparing languages) Ints and cast to floats implicitly If and Only if there they are being combined with somthing which already is a float. so that

1+1 = 2

1+ 1.5 = 1.0 + 1.5 = 2.5

Granted doing this efficiently could be non-trivial. but I would on balance rather it be the general case and have a set of explicitly Integer variants for cases where I know I really want Integer operations.

iadd etc perhaps.

Locked