From JLS@liverpool.ac.uk Thu Aug 20 12:24:41 1992
Received: from vm.uni-c.dk by dkuug.dk via EUnet with SMTP (5.64+/8+bit/IDA-1.2.8)
	id AA13737; Thu, 20 Aug 92 12:24:41 +0200
Message-Id: <9208201024.AA13737@dkuug.dk>
Received: from vm.uni-c.dk by vm.uni-c.dk (IBM VM SMTP V2R2) with BSMTP id 2410;
   Thu, 20 Aug 92 12:25:22 DNT
Received: from UKACRL.BITNET by vm.uni-c.dk (Mailer R2.07) with BSMTP id 0786;
 Thu, 20 Aug 92 12:25:21 DNT
Received: from RL.IB by UKACRL.BITNET (Mailer R2.07) with BSMTP id 7410; Thu,
 20 Aug 92 11:24:21 BST
Received: from RL.IB by UK.AC.RL.IB (Mailer R2.07) with BSMTP id 0090; Thu, 20
 Aug 92 11:24:20 BST
Via:         UK.AC.LIV.IBM; 20 AUG 92 11:24:15 BST
Received:     from UK.AC.LIVERPOOL
              by MAILER(4.4.t);  20 Aug 1992 11:21:37 BST
Date:        Thu, 20 Aug 92 10:47:54 BST
From: Lawrie Schonfelder <JLS@liverpool.ac.uk>
Subject:     Re: Re: RFI: how to add unsigned
To: Keith.Bierman@eng.sun.com, SC22/WG5 members
        <SC22WG5@dkuug.dk>
In-Reply-To: Your message of Wed, 19 Aug 92 11:37:16 PDT
X-Charset: ASCII
X-Char-Esc: 29

On Wed, 19 Aug 92 11:37:16 PDT Keith.Bierman@COM.Sun.Eng said:

>>resticted range of values and no operation nor type checking. The latter could
>
>But it isn't merely restricted; it is larger on top, smaller on
>bottom ... and totally non-symmetric around zero.
As Kurt correctly pointed out unsigned integers are the mathemetical objects
known as NATURAL numbers and should be treated as a separate type. The
characteristic property of such numbers is that they are a subset of the
integers bounded below by zero. If one is to model these by integers then
the representable values are [0,HUGE(0)]. As I understand their use in C
they employ the same number of bits as an integer but interpret them as
representing an unsigned binary number. This is likely to produce a set of
values [0, approx 2*HUGE(0)]. To model NATURAL numbers by integers is quite
straight forward. To model bit patterns in machine words is not. This raises
the philosophical question of whether Fortran should be modeling machine words
or the "real" world abstract entities like NATURAL, INTEGER, REAL and COMPLEX
numbers. I make no secret that my belief is we are about the latter. C which
is rightly a high level assembler for a Von Neumann architechure machine is
aimed at the former.
>
>Assuming one provides it via a module, what would be the right way to
>describe unsigned quantities given the model that we have embedded for
>integers?
>
I believe a type such as NATURAL is sometimes useful. And as such should be
optionally available. It should therefore like the VARYING_STRING be made
available via the module/use interface method (which does not preclude it being
provided as an intrinsic part of a particular compiler as an optional intrinsic
facility). The problems with this have been pointed out by Kurt and myself many
times. However, Kurt uses them to argue for a full intrinsic type whereas I
would argue that we should fix the general defects in the language which does
not permit derived types to be made fully co-functional with intrinsic types.
The specific NATURAL type couls be
TYPE NATURAL
  INTEGER :: natin
ENDTYPE NATURAL

The definitions of the operations on objects of type NATURAL would need to
check for out of bounds results.
Sure we have a problem of no KIND parameters. THis is a general problem
due to the lack of parameterised data types. WE do not have proper constant
construction, variable initialisation, or I/O. All of these general
deficiencies in the extension mechanisms need to be addressed as solving the
general problem. Solving a host of particular problems by adding more and more
intrinsic types is not a sensible way forward for language design.

Lawrie
