wmb@MITCH.ENG.SUN.COM (08/03/90)
> What provisions does ans-forth provide for different length stack data > types? I know about cell/cells/cell+, ... for making the "size" of a > normal-length "cell" portable, but what about the different > number types? > > For example, forth-83 has single and double length > numbers, corresponding to 16 and 32 bit lengths > on most 8bit forths. ANS Forth has single and double length numbers too, but the precise number of bits is not specified. The minimum range is specified (a single number must be able to represent at least the range -32767 : +32767) but there is no provision for asking for exactly the size that you need. > As another example, Mitch Bradley has a "type" system which > explicitly specifies the number of bits that a type has, > and makes a distinction between a double number which just > 2 normal sized stack entries, and a 32 bit arithmetic quantity > known as a long. I proposed this to the ANS committee quite early on, but it was rejected. This capability is particularly useful when writing programs to deal with externally-imposed data types, such as network packets or control blocks for hardware devices (and contrary to a popular opinion, if you are programming hardware, you often DO care about portability. I have numerous I/O device drivers that need to work across Forth systems with different CPUs). Both Pascal and C suffer from the same problem (lack of externally- precise data types). These languages have data structure facilities that are sufficient for storage and retrieval of data generated and consumed by the same program, but are not sufficient for portable communication of data structures between different programs (perhaps running on different machines) and between programs and hardware. Mitch