Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Proposal for study: Add a categorical Initial type to ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <Damien.Doligez@i...>
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