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!news3.google.com!feeder.news-service.com!feeder.erje.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Dynamic Variant Record Creation Date: Tue, 16 Mar 2010 18:39:18 -0500 Organization: Jacob Sparre Andersen Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1268782760 15192 69.95.181.76 (16 Mar 2010 23:39:20 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 16 Mar 2010 23:39:20 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Xref: g2news2.google.com comp.lang.ada:10591 Date: 2010-03-16T18:39:18-05:00 List-Id: "Adam Beneschan" wrote in message news:c3fa9a0f-99c7-4fff-9310-7e4d769065db@s25g2000prd.googlegroups.com... ... >By the way, now that Ada 2005 has the <> construct for aggregates, >it's just occurred to me that maybe 4.3.1(17) can be relaxed a bit, to >make it legal to specify a record aggregate with a nonstatic >discriminant for a variant record, *if* the only component >associations for aggregates are components that are not in variant >parts *and* there is an others=><> in the aggregate (or something >along those lines). I don't know whether it's worthwhile, though. >(It wouldn't help too much in this exact example, since there are no >non-variant components, but if it were expanded to include, say, a >source file name, line number, and column number for each Token_Unit, >then there would be some benefit.) I'll consider making a proposal >for this, depending on how loud a groan Randy, Bob, etc., make when >they read this idea... :) 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; The compiler could combine similar variants, I guess, but it often doesn't help much. And it looks like a very complex mess. Randy.