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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7936408ed8296efa X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-16 15:14:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!news-xfer.nuri.net!newsfeed.dacom.co.kr!howland.erols.net!logbridge.uoregon.edu!titan03.ksc.nasa.gov!niven.ksc.nasa.gov!usenet From: "Samuel T. Harris" Newsgroups: comp.lang.ada Subject: Re: User define attributes Date: Mon, 16 Apr 2001 17:00:17 -0500 Organization: Raytheon Aerospace Engineering Services Message-ID: <3ADB6B71.386A647E@gsde.hou.us.ray.com> References: <9b9g7c$cp6$1@taliesin.netcom.net.uk> <3ada9cf5$1@pull.gecm.com> <9behk1$ik9$1@taliesin.netcom.net.uk> <3adad7ab$1@pull.gecm.com> <3ADB033A.F10344A9@gsde.hou.us.ray.com> <3adb0ba1$1@pull.gecm.com> <3ADB1BAA.6F4E0437@gsde.hou.us.ray.com> <9bf8uj$7e9$1@nh.pace.co.uk> Reply-To: samuel_t_harris@raytheon.com NNTP-Posting-Host: sstf-fw.jsc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.7 [en] (X11; U; IRIX64 6.2 IP19) X-Accept-Language: en Xref: supernews.google.com comp.lang.ada:6930 Date: 2001-04-16T17:00:17-05:00 List-Id: Marin David Condic wrote: > > It seems reasonable to me to say that if you have to provide a translation > of a compound type into some stream of bytes (degenerating to the collective > internal representations of the primitive types plus index/discriminant > info) that adding a similar character representation ought to be near > trivial. When you get down to the bottom layer, instead of binary, you > translate to ASCII. Coming back in might be more difficult if you expect the > input to be user forgiving, but that shouldn't be any worse than calling the > 'Value routines for the primitive types. Or an implementation is free to say > that the only thing guaranteed to work is Typename'Value(Typename'Image(X))? My functions, and my original question, dealt with Ada's aggregate with named notation. Specifically qualified aggregates where the full type name and a "'" preceeds the aggregate. > > Personally, I'd be at least mostly happy if the requirement were to give me > a dump of a compound structure from byte zero to byte N (plus the dope > information?) in various formats. (ASCII, hex, integer, etc.) This would > enable dumping the stuff out for debugging purposes which is usually the > reason I'd want a 'Image attribute for them anyway. (Rolling your own isn't > hard once you've got the object into a stream, but why not go for a > convenience feature?) Of course, aggregates using named notation have no need for dope vectors. Record discriminants come first so no problem there. By using qualified aggregates, even complications introduced by tagged types are trivially handled. > > Most "real" outputs would want to be formatted in far more detail than I > could ever expect to get from a 'Image attribute anyway, so I wouldn't need > it except as a quick and dirty mechanism to see what is in the structure. It > is certainly handy for student-level programs. ('Image and 'Value are a lot > easier to explain than Text_IO when you just want to get someone rolling > with a "Hello World" program.) Or possibly for outputing a compound object > to a text file to be read back in at a later point? But then why not just > use Streams? (Maybe there should be a "Typename'Dump (X)" attribute with no > requirement other than the implementation provide some kind of human > readable text for the contents of X?) I don't need "real" outputs. I just want convenient output for anything I want, in function form suitable to be called directly from the debugger. By standardizing on Ada aggregate notation, I can even switch output with source code and source code as input. I even handle pointers in a portable manner. One of the inconveniences in my experience with using streams or other binary representation for transmission is that I cannot simply use a network sniffer to spoof the contents. If I'm passing all data packets with textual contents, I can read what a distributed system is doing with any old spoofer. -- Samuel T. Harris, Principal Engineer Raytheon, Aerospace Engineering Services "If you can make it, We can fake it!"