From: | George Neuner <gneuner2@comcast.net> |
Newsgroups: | comp.compilers |
Date: | Thu, 30 Dec 2010 15:56:55 -0500 |
Organization: | A noiseless patient Spider |
References: | 10-12-046 10-12-049 10-12-055 |
Keywords: | design, storage |
Posted-Date: | 30 Dec 2010 23:01:50 EST |
On Tue, 28 Dec 2010 18:22:54 -0500, Robert A Duff
<bobduff@shell01.TheWorld.com> wrote:
>Gene <gene.ressler@gmail.com> writes:
>
>> type Possibly_Valid_Float is new Float with (Unknown);
>
>You can do this sort of thing in OCaml. Type "Maybe(Float)" is either
>a float or nothing. It's pretty elegant, and doesn't require any
>special "enumeration types" or "enumeration type extensions".
Ocaml's alternation types are enumerated - it just isn't visible at
the language level. In the general case, alternation types are
implemented as variant records with compiler generated tags. When the
correct alternation can be statically determined, the compiler is
permitted to substitute the alternation's simple record type in place
of the variant type.
George
Return to the
comp.compilers page.
Search the
comp.compilers archives again.