From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c469fdacc2f3302b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!news.glorb.com!news2.glorb.com!news.mv.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Dynamic Variant Record Creation Date: Tue, 16 Mar 2010 20:15:36 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1268784924 2766 192.74.137.71 (17 Mar 2010 00:15:24 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 17 Mar 2010 00:15:24 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:uQ25NBPC5NrqewLYqyXzm1Tzy2E= Xref: g2news2.google.com comp.lang.ada:10593 Date: 2010-03-16T20:15:36-04:00 List-Id: "Randy Brukardt" writes: > GROAAANNN!!! :-) ;-) > I'd like to see a solution to this problem, but I don't think this is it. > The problem is that the compiler wouldn't know what components to generate, > so it would effectively have to generate a giant case statement: > > X := (Token => T, others => <>) would become: > > case T is > when LEX_ID => X := (Token => LEX_ID, String_Id => <>); > when '!' => X := (Token => '!'); > ... > end case; Well, this is not hugely different from the case statement that the compiler has to generate for: X : Token_Unit (Token => T); to default-initialize stuff. But I agree it's not worth the trouble. By the way, why do we call the kind/type of token "Token", and the whole token is "Token_Unit" or some such? I realize that's what the compiler textbooks often do, but I'd prefer the enumeration be called Token_Kind, and the record (containing the kind as well as the identifier string or whatever) be called something else, like Token. - Bob