comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <mcondic.auntie.spam@acm.org>
Subject: Re: Conditional types?
Date: Mon, 11 Nov 2002 08:30:18 -0500
Date: 2002-11-11T13:37:14+00:00	[thread overview]
Message-ID: <aqobqa$936$1@slb4.atl.mindspring.net> (raw)
In-Reply-To: mpzz9.1093$rG2.14157@sccrnsc03

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 <nospam@hotmail.com> 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.
>






  parent reply	other threads:[~2002-11-11 13:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-10 20:34 Conditional types? Caffeine Junky
2002-11-10 23:04 ` Dennis Lee Bieber
2002-11-13  6:41   ` AG
2002-11-11 13:30 ` Marin David Condic [this message]
2002-11-11 17:30   ` Larry Kilgallen
2002-11-12 12:50     ` Marin David Condic
  -- strict thread matches above, loose matches on Subject: below --
2002-11-10 20:34 Caffeine Junky
2002-11-10 21:35 ` tmoran
2002-11-11  4:43   ` Caffeine Junky
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox