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,e61c8636ef35379d X-Google-Attributes: gid103376,public From: Marin David Condic Subject: Re: Ada Streams usage (was Escape Sequences in Strings) Date: 2000/11/20 Message-ID: <3A1939E1.AA643766@acm.org>#1/1 X-Deja-AN: 695769622 Content-Transfer-Encoding: 7bit References: <3A17B0E2@MailAndNews.com> <3A129A89.1B69E2FE@acm.org> <3A13D59E.63A6F92@earthlink.net> <3A168546.89CA38F7@acm.org> <3A177878.AD747325@telepath.com> <3A182633.BDE82EA9@acm.org> <8v9lip$2dr$1@nnrp1.deja.com> X-Accept-Language: en X-Server-Date: 20 Nov 2000 14:50:03 GMT Content-Type: text/plain; charset=us-ascii Organization: Quadrus Corporation Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-11-20T14:50:03+00:00 List-Id: Robert Dewar wrote: > Well I find that a little pessimistic. The representation > of primitive items should be governed by the IA in the RM > > 17 If a stream element is the same size as a storage element, > then the normal in-memory representation should be used by Read > and Write for scalar objects. Otherwise, Read and Write should > use the smallest number of stream elements needed to represent > all values in the base range of the scalar type. > Which is fine - right up to the point where something in the message stream doesn't exactly line right up on an even byte boundary. Don't tell me that never happens, because it does. Please don't say "thats a bad protocol" because it doesn't matter when you're trying to communicate with some piece of avionics that is 20 years old and you can't redesign the protocol that came with it. Its stuff like this that means I have to have 100% absolute total control over the exact and precise representation of the data right down to the bit level. I can't do that with streams as easily as I would like. Yes, I can find ways to "cheat" and get things to work. I've been doing that sort of cheating professionally for a number of years now. :-) Its just that I don't end up with as clean and elegant an answer as I would like. I don't think it is a "frundamental" flaw in the language - it might be fixable with a few pragmas. > > Note that in all implementations in normal use the predicate > at the start of this paragraph is true. > > There is a bit of a puzzle about base types, but that is > compeltely resolved by a recent AI (GNAT incidentally is > already conforming to the recommendations of this AI, and > always has). > > As for compound types, the RM requires that these be output > as a sequence of stream elements for the primitive components, > recursively, so this is 100% well defined. "Well Defined" is not the same thing as "Useful". I'm sure you understand that. The "recursive" nature of this poses a problem in terms of efficiency - it can (and does in the tests I've run) degenerate to a whole bunch of really small procedure calls. It also doesn't necessarily guarantee what I'm going to get if I have spanned data across byte boundaries or figured out other ways of making my life difficult. :-) I may get a guarantee of a certain behavior. It just doesn't guarantee the behavior I want. 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 ======================================================================