From: | Robert A Duff <bobduff@shell01.TheWorld.com> |
Newsgroups: | comp.compilers |
Date: | Tue, 28 Dec 2010 18:22:54 -0500 |
Organization: | The World Public Access UNIX, Brookline, MA |
References: | 10-12-046 10-12-049 |
Keywords: | types, design |
Posted-Date: | 28 Dec 2010 18:38:56 EST |
Gene <gene.ressler@gmail.com> writes:
> True.
Not clear what you're replying to.
> Much nicer would be
>
> type Possibly_Valid_Float is new Float with (Unknown);
OK, but you can't expect existing code that uses Float to
work properly with Possibly_Valid_Floats.
Also, you can't have Possibly_Valid_Floats other than those
two possibilities -- it's either a Float or it's not.
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".
- Bob
Return to the
comp.compilers page.
Search the
comp.compilers archives again.