Re: Proposal for study: Add a categorical Initial type to ocaml

From: Damien Doligez (Damien.Doligez@inria.fr)
Date: Tue Oct 12 1999 - 17:33:27 MET DST


Date: Tue, 12 Oct 1999 17:33:27 +0200
From: Damien Doligez <Damien.Doligez@inria.fr>
Message-Id: <199910121533.RAA19966@tobago.inria.fr>
To: caml-list@inria.fr
Subject: Re: Proposal for study: Add a categorical Initial type to ocaml

>From: skaller <skaller@maxtal.com.au>

>There proposal is for a syntactic designator (say '$') for the
>non-existant value of the initial type, which can
>be bound to a variable of any type.
>[You could say it has type 'a, as does 'raise SomeException']
>
>The effect of attempting to read this value from any type
>should be to raise the exception Uninitialised_value.

You could try to use "lazy (raise Uninitialised_value)", of type
'a lazy, with the advantage that the notion of "reading this value"
becomes clearly defined (it is using "force" on the value).

>A better name than $ is probably 'none'.
>Boxed values can use a null pointer for none.

OK.

>Integers and floats can be treated as follows:
>do not initialise them at all, if -unsafe is
>specified. Otherwise, use the spare value of integers

What spare value ?

>and some NaN for floats,

This may or may not be possible, depending on the details of the IEEE
specification.

>Chars can be handled too, but it is probably not worth the
>effort until they are lifted to ISO10646, which has
>suitable code points available. [We could use 0xFF for
>8 bit chars]

No. 0xFF is already used, as well as the other 255 values.

-- Damien



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:27 MET