From: Timothy H. <tim...@ma...> - 2002-04-13 16:29:19
|
We have removed the partial attempt we had made at adding automatic narrowing and widenning for numeric types in the dynamic dispatch of jscheme. The goal was to make it easy to use methods and fields whose types are numeric values that are not the default types (integer or double). We have opted instead to introduce new syntax for numeric literals so that bytes, shorts, ints, longs, floats, and doubles can all be expressed directly as literals and can be distinguished by their printed form. Thus the following is now legal Jscheme: > (Byte. 5b) 5B > (Byte. 5B) 5B > (Short. 7s) 7S > (Short. 7S) 7S > (Integer. 12) 12 > (Long. 4L) 4L > (Long. 4l) 4L > (Float. 5F) 5.0F > (Float. 5f) 5.0F > (Double 9.0) 9.0 Currently the arithmetic operators follow the java model and convert floats to doubles and bytes and shorts to ints before doing any arithmetic. Thus you must use (.byteValue N) (.shortValue N) or (.floatValue N) expressions of Numeric type to return values of type byte,short, or float . ---Tim--- |