Hi all I', really happy that I sparked some productive discussion which does not revolve around mice and fonts :) ! I'm really uncomfortable with trying to hide the size of variables i.e. having a single integer type. I feel that this actually detracts from the portability of the code. In representing numbers we have physical representations of abstract entities. We only have a finite number of bits available on a given machine. That in itself is usually not a problem, the problem arises when we have need to port code to a different machine as was pointer out by Patrick. Most people are aware of the architecture specific nature of C's "int"-type. I believe programming should be very pedantic. In fact, in a programming language on which I worked we did away with "generic terms" for integer variables. The basic integer types of the language were UINT8,INT8 UINT16,INT16 UINT32,INT32 The sub-class super class semantice are the same as for Oberon namely a larger integer type contains the smaller type. Signed and unsigned types are incompatible. In fact the concept was taken even further to contain explicit set sizes: SET8,SET16 and SET32 Internally operations are still performed on 32-bit sets, but does the necessary conversions on loading and storing. As such it is mostly syntactic lolli-pops, but does get rid of all those ghastly SYSTEM.VALs The benifit of all this is that it is easy to extend to say UINT64 of INT128 to add support for new architectures without breaking existing code or the other way around. In the interim the most sensible solution would be to simply write a separate module for each architecture, that implements unsigned operations and types. Patrik don't worry I don't expect changes to Oberon any time soon. It's just ideas being tossed around. In the final analysis that why were here :) Frank --------------------------------------- Frank van Riet (Software Developer) Datavoice (Pty) Ltd Snail mail PO Box 582 Stellenbosch 7599 South Africa Tel +27 21 888-2118 Mobile +27 82 970 5704 Web http://www.datavoice.co.za ----------------------------------------
Frank van Riet wrote:
Hi all
I', really happy that I sparked some productive discussion which does not revolve around mice and fonts :) !
I'm really uncomfortable with trying to hide the size of variables i.e. having a single integer type. I feel that this actually detracts from the portability of the code.
In the programming language MAINSAIL (Machine Independent SAIL) which I used before discovering Oberon all numeric calculations were "guarenteed" to a given number of bits or a given number of decimal places. Porting from machine to machine was trivial. The accuracy could only improve above that guarenteed. (MAINSAIL was also module based (circa 1976). It even swapped modules if memory was low, but then thrashing could result). -Doug
Hi all On Tue, 27 Aug 2002, Frank van Riet wrote:
I'm really uncomfortable with trying to hide the size of variables i.e. having a single integer type. I feel that this actually detracts from the portability of the code. In representing numbers we have physical representations of abstract entities. We only have a finite number of bits available on a given machine. That in itself is usually not a problem, the problem arises when we have need to port code to a different machine as was pointer out by Patrick. Most people are aware of the architecture specific nature of C's "int"-type.
You're right, its indeed idealistic to expect a generic integer type in a language, because of the limitations imposed by processors and implementations. Nevertheless, just for the interest, in "From Modula to Oberon" (1988), N. Wirth definitely followed the idea of abstraction: "the language must be defined in terms of mathematical, abstract concepts without reference to any computing mechanism. Only if a language satisfies this criterion, can it be called `higher-level'. No syntactic coating whatsoever can earn a language this attribute alone." This makes the *language* as such portable, but indeed restricts the portability of the code in the language, as FvR has mentioned. Wirth again: "Limitations imposed by particular implementations do not belong to a language definition proper. Examples of such restrictions are the maximum values of numbers, rounding and truncation errors in arithmetic, and actions taken when a program violates the stated rules. It should not be necessary to supplement a language definition with a voluminous standards document to cover `unforeseen' cases." That is why the functions MAX() and MIN() are used in the definition of the basic numerical types and the SET type, to allow flexibility between implementations. This indeed makes code hardly portable, when assumptions are made as to the results of these functions, for example when it is assumed that a SET may contain 32 values - there are implementations where a SET may only contain 16 values (or whatever). (Patrik you're right - SETs should not be a problem in low-level programming) Wirth also understood the other side of the abstract coin: "But neither should a programming language be a mathematical theory only. It must be a practical tool." ... "Several features of Oberon are superfluous from a purely theoretical point of view. They are nevertheless retained for practical reasons, either for programmer's convenience or to allow for efficient code generation" ... He admitted that "Neither the language nor its defining document reaches the ideal; but Oberon approximates these goals much better than its predecessors". So there is room for careful improvement, in the "spirit of Oberon". (It is happening: the introduction of Active Objects is an example... :-) --Willem -- Willem Myburgh Department of Computer Science University of Stellenbosch, Private Bag X1, Matieland 7602 South Africa Email: myburgh@cs.sun.ac.za "http://www.cs.sun.ac.za/~myburgh/" Tel: +27 (0)21 808 4389 (W) Fax: +27 (0)21 808 4416 Mobile: +27 (0)83 415 0416 -----------------------------------------------------------------------
storing. As such it is mostly syntactic lolli-pops, but does get rid of all those ghastly SYSTEM.VALs
I know, whenever writing low-level code, you may end up writing tons of SYSTEM.VAL; at least they don't cost anything at all, since this instruction is just to change the way the compiler interprets the value, but usually generates no code at all.
The benifit of all this is that it is easy to extend to say UINT64 of INT128 to add support for new architectures without breaking existing code or the other way around.
Which also makes the language portable across platforms with different word-size.
Patrik don't worry I don't expect changes to Oberon any time soon. It's just ideas being tossed around. In the final analysis that why were here :)
Thanks! I'm really appreciate how this discussion is nicely evolving along the technical details which help everybody understand and evaluate the pros and cons of such a change, instead of degenerating in a useless flame war. -Patrik
participants (4)
-
Douglas G. Danforth -
Frank van Riet -
Patrik Reali -
Willem Myburgh