gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] variant records and repeated names


From: Martin Kalbfuß
Subject: Re: [Gm2] variant records and repeated names
Date: Wed, 16 Dec 2009 17:38:10 +0100

A small example:

TYPE testType = (variant1, variant2, variant3);

     test = RECORD;
        shared : INTEGER;
        CASE type : testType OF
        variant1:
           a : INTEGER;
           b : INTEGER |
        variant2:
           b : INTEGER;
           c : INTEGER |
        variant3:
           a : INTEGER;
           c : INTEGER;
        END;
     END;

compiler reports an error because the names a, b and c are present
multiple times inside the record. But they are in different variants. So
I assume this should be OK.

Am Mittwoch, den 16.12.2009, 10:57 +0000 schrieb Gaius Mulley:
> Martin Kalbfuß <address@hidden> writes:
> 
> > Hi,
> >
> > I have a variant record.
> > the different variants have equaly named fields.
> >
> > If I try to compile I get
> >
> > EventBase.def:331:14: error: field state is already present inside
> > record Event
> > EventBase.def:336:14: error: field which is already present inside
> > record Event
> > EventBase.def:337:14: error: field state is already present inside
> > record Event
> > EventBase.def:344:14: error: field which is already present inside
> > record Event
> > EventBase.def:346:14: error: field state is already present inside
> > record Event
> > EventBase.def:347:14: error: field y is already present inside record
> > Event
> > EventBase.def:347:14: error: field x is already present inside record
> > Event
> > EventBase.def:351:14: error: field which is already present inside
> > record Event
> > EventBase.def:357:14: error: field which is already present inside
> > record Event
> > EventBase.def:364:14: error: field which is already present inside
> > record Event
> > EventBase.def:366:14: error: field value is already present inside
> > record Event
> > EventBase.def:374:14: error: field which is already present inside
> > record Event
> > EventBase.def:375:14: error: field button is already present inside
> > record Event
> > EventBase.def:376:14: error: field state is already present inside
> > record Event
> >
> >
> > Shouldn't it be allowed to have equaly named fields for different
> > variants of the record?
> >
> > Thanks,
> 
> Hi Martin,
> 
> please can you give a code example..
> 
> thanks Gaius






reply via email to

[Prev in Thread] Current Thread [Next in Thread]