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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2e66fe8b30e3ee2c X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: Rep clause problems, was Re: S'Write and How To Count Bytes Date: 2000/10/03 Message-ID: <39DA256D.D854277B@acm.org>#1/1 X-Deja-AN: 677137233 Content-Transfer-Encoding: 7bit References: <39D9DD58.86538032@acm.org> X-Accept-Language: en X-Server-Date: 3 Oct 2000 18:29:16 GMT Content-Type: text/plain; charset=us-ascii Organization: Quadrus Corporation Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-10-03T18:29:16+00:00 List-Id: tmoran@bix.com wrote: > So the basic problem is representation clauses, and Streams only come > into the picture because the rep clauses are giving too many problems. > And the rep clause problems are specific to tagged types. > Right? Well, using the Stream attributes seems to be more of "The Ada Way" to do it, but as noted, you may not be able to control the representation of individual elements very well. (Also, there are overhead issues - just in case you're building hard realtime systems. But thats a complaint that is not universal.) You'd be dependent on the good graces of your compiler to do the right thing, and changing compilers or getting new releases might mess up your format. (Obvious example: With a field of type Integer, a given compiler may give you 16 bits and another might give you 32 bits. The ARM says you should get the normal in-memory representation, but it is not a promise and you're up against system dependencies.) So with my technique, you could avoid the whole mess just so long as you could absolutely control the representation of a tagged record. Various suggestions have been made to, for example, put a well-rep'd record inside the tagged record, but this has problems with not allowing class-wide operations to be built. You've got to build a new set of operations for each new type in the class. Yeah, you can do it, but then you're defeating the elegance of the solution and forcing a lot of work on building the descendent types. Also, its tough to come up with good ways of doing things like checksumming the records and other things that rely on looking at the whole thing as a unit. The rep clauses may or may not be specific to tagged records. Some of it seems to be language rules, but there is some debate about the legalities of it all. Some of it may be specific to the compiler you pick - after all, it is perfectly legal for a compiler to say: "I don't give a rat's corpse what you asked for in the rep clause, this is what you're going to get." Legal - just not useful. I've built a number of small test examples to try to coerce the representation of tagged records into what I want and have just never been able to get it to work. Perhaps I need to find a couple of different compilers and see if the behavior is universal. MDC -- ====================================================================== Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/ Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m Visit my web site at: http://www.mcondic.com/ "Giving money and power to Government is like giving whiskey and car keys to teenage boys." -- P. J. O'Rourke ======================================================================