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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6828bb58accfa664 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-11 05:37:14 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!wn11feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Conditional types? Date: Mon, 11 Nov 2002 08:30:18 -0500 Organization: MindSpring Enterprises Message-ID: References: NNTP-Posting-Host: d1.56.b3.8d X-Server-Date: 11 Nov 2002 13:37:14 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Xref: archiver1.google.com comp.lang.ada:30722 Date: 2002-11-11T13:37:14+00:00 List-Id: What you seek to do is, in fact, impossible. Given that some collection of random bits can be used to represent *anything* (integers, floats, fixed point, binary angular measurements, characters, an infinite number of possible enumerations, etc.) you can't tell by staring at the data itself what the proper interpretation of the data is. Unless some language incorporates some kind of additional information along with the data itself, you don't stand a chance. I could imagine a language that had a convention of passing a descriptor, plus the data itself, but the descriptor can only give you information about some general classes of data. "What follows is some kind of array" or "The next 32 bits is an Integer". It couldn't possibly pass the entire information about the type unless it retained the entire high-level language description - which would be highly inefficient. You can work from what you *do* know about a type based on what the language allows. Example: When you use a 'class parameter, the base class can tell you a lot about what is possible with any of the derived classes. That's what abstract operations are good for. The base class could also include operations that tell you what type of data is in the derived type. Its not highly efficient if all you want to do is pick the correct math operations to use, but it is at least very flexible. MDC -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jast.mil/ Send Replies To: m c o n d i c @ a c m . o r g "I'd trade it all for just a little more" -- Charles Montgomery Burns, [4F10] ====================================================================== Caffeine Junky wrote in message news:mpzz9.1093$rG2.14157@sccrnsc03... > I've been trying to figure out if theres a way in Ada(or any other > language for that matter) to test if data is of a certain type without > going into low level bit fiddling and Assembler instructions. >