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

George Neuner <gneuner2@comcast.net>
Thu, 30 Dec 2010 15:56:55 -0500

          From comp.compilers

Related articles
[9 earlier articles]
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)
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 bobduff@shell01.TheWorld.com (Robert A Duff) (2010-12-31)
Re: language design implications for variant records in a pascal-like bobduff@shell01.TheWorld.com (Robert A Duff) (2010-12-31)
Re: language design implications for variant records in a pascal-like fw@deneb.enyo.de (Florian Weimer) (2010-12-31)
Re: language design implications for variant records in a pascal-like noitalmost@cox.net (noitalmost) (2010-12-31)
[40 later articles]
| List of all articles for this month |

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


Post a followup to this message

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