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

George Neuner <gneuner2@comcast.net>
Thu, 30 Dec 2010 16:06:08 -0500

          From comp.compilers

Related articles
[10 earlier articles]
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)
Re: language design implications for variant records in a pascal-like gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-01-02)
[39 later articles]
| List of all articles for this month |

From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.compilers
Date: Thu, 30 Dec 2010 16:06:08 -0500
Organization: A noiseless patient Spider
References: 10-12-040 10-12-052
Keywords: storage, design
Posted-Date: 30 Dec 2010 23:02:10 EST

On Mon, 27 Dec 2010 13:58:47 -0500, noitalmost <noitalmost@cox.net>
wrote:


>I suppose I have an initial prejudice against variant records. They
>seem to me to be a potential source of hard to find bugs (for the
>user programmer, I mean, not the compiler designer). Am I wrong about
>this? Is it possible for the compiler to always know which type is
>active in the variant, like say through a hidden compiler-generated
>variable in the record?


It isn't always possible to know statically which alternation is
active ... but it is possible to make certain the code covers all
cases and to optimize paths for which the correct alternation is
known. The ML family of languages (ML, SML, Caml, Ocaml, etc.)
guarantee to cover all cases and (usually) also can optimize the
different alternation paths.


George



Post a followup to this message

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