Re: language design implications for variant records in a pascal-like language

Robert A Duff <bobduff@shell01.TheWorld.com>
Tue, 28 Dec 2010 18:22:54 -0500

          From comp.compilers

Related articles
[4 earlier articles]
Re: language design implications for variant records in a pascal-like mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2010-12-25)
Re: language design implications for variant records in a pascal-like DrDiettrich1@aol.com (Hans-Peter Diettrich) (2010-12-25)
Re: language design implications for variant records in a pascal-like gene.ressler@gmail.com (Gene) (2010-12-27)
Re: language design implications for variant records in a pascal-like bobduff@shell01.TheWorld.com (Robert A Duff) (2010-12-27)
Re: language design implications for variant records in a pascal-like noitalmost@cox.net (noitalmost) (2010-12-27)
Re: language design implications for variant records in a pascal-like cr88192@hotmail.com (BGB) (2010-12-27)
Re: language design implications for variant records in a pascal-like bobduff@shell01.TheWorld.com (Robert A Duff) (2010-12-28)
Re: language design implications for variant records in a pascal-like mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2010-12-29)
Re: language design implications for variant records in a pascal-like bc@freeuk.com (BartC) (2010-12-29)
Re: language design implications for variant records in a pascal-like DrDiettrich1@aol.com (Hans-Peter Diettrich) (2010-12-29)
Re: language design implications for variant records in a pascal-like marcov@turtle.stack.nl (Marco van de Voort) (2010-12-30)
Re: language design implications for variant records in a pascal-like gneuner2@comcast.net (George Neuner) (2010-12-30)
Re: language design implications for variant records in a pascal-like gneuner2@comcast.net (George Neuner) (2010-12-30)
[45 later articles]
| List of all articles for this month |
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


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.