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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e429176c9adb07b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-19 10:37:54 PST Message-ID: <3E53CE60.1030008@cogeco.ca> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: [OT] Best way to isolate a GUI? (The final concensous?) References: <3E511C15.1040404@acm.org> <3E5121BD.4010200@cogeco.ca> <3E51A55A.3000101@cogeco.ca> <3E52A1BF.1020809@cogeco.ca> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 19 Feb 2003 13:35:12 -0500 NNTP-Posting-Host: 198.96.47.195 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1045679715 198.96.47.195 (Wed, 19 Feb 2003 13:35:15 EST) NNTP-Posting-Date: Wed, 19 Feb 2003 13:35:15 EST Organization: Bell Sympatico Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Xref: archiver1.google.com comp.lang.ada:34233 Date: 2003-02-19T13:35:12-05:00 List-Id: Marin David Condic wrote: > Why would you want to use a variant record when a tagged type solves the > problem so much more elegantly? I've always found variant records to be a > pain in the posterior - in particular as noted by Randy that you have to > define everything in one place. If you wanted to pass back to an app various > events (or widget data, for that matter) it would seem that a base class of > some sort of "event" or "message" would be the place to start. You then > build up from that class the specific events or messages you need in > separate packages. If something gets added on top that message catalog, > you're not impacting anything else and the extension doesn't force > recompilation of the whole world. > > Short of possibly efficiency concerns or representation issues, I just don't > see much excuse for variant records when we've got tagged types. > > MDC > -- For the most part Marin, I have conceded the point to Randy. Tagged records provide one very important advantage, that I consider to be important: the fact that you can define a simple base type, and then extend it from separate other package specs as needed. That feature is very much worth having, IMO. Tagged records need not be the final answer to all things event wise however. Doing a case statement on a discriminant of a variant record is easier than doing a number of "if object in Some'Class then" tests. Especially if there is a common set of elements and some variations for the event in question. So my concession is this: 1) Use tagged types for event data (with a abstract or bare "base" type). 2) Extend the event base type in the package specs as required 3) Callback is defined as receiving some Base'Class argument. 4) Within the final tagged type, perhaps use variant records to distinguish variations of that event. Basically I guess where I am coming from is that I don't see a tagged type for "every variation". That is perhaps a point where we'll all disagree ;-) -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg