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

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Wed, 29 Dec 2010 17:01:59 +0100

          From comp.compilers

Related articles
[7 earlier articles]
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)
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)
[42 later articles]
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Wed, 29 Dec 2010 17:01:59 +0100
Organization: Compilers Central
References: 10-12-040 10-12-052
Keywords: storage, design
Posted-Date: 30 Dec 2010 10:58:30 EST

noitalmost schrieb:


> 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?


Most (Wirthian) variant records have an (optional) Tag field, but most
implementations don't use it for the selection of one variant at
runtime, most probably for compiler simplicity and performance issues.
Ada may be more strict here (dunno).


At least there must exist rules for what happens when the Tag field is
changed. IMO the variant part should be cleared then - otherwise the Tag
if of no real value for the compiler and coder.


DoDi



Post a followup to this message

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