comp.lang.ada
 help / color / mirror / Atom feed
From: Charles Hixson <charleshixson@earthling.net>
Subject: Re: Looping over a tagged record?
Date: Fri, 22 Jun 2001 17:33:07 GMT
Date: 2001-06-22T17:33:07+00:00	[thread overview]
Message-ID: <Xns90C86B56DE86charleshixsonearthli@207.217.77.23> (raw)
In-Reply-To: JVxY6.222013$p33.4452203@news1.sttls1.wa.home.com

"DuckE" <nospam_steved94@home.com> wrote in
news:JVxY6.222013$p33.4452203@news1.sttls1.wa.home.com: 

> 
> "Charles Hixson" <charleshixson@earthling.net> wrote in
> message 
>  [snip]
>>...
>> out how I can do this in a way that doesn't make me rewrite
>> everything whenever a new class is described ... 
> 
> "...inheritance in C"
> 
>   Say what?
> 
> Perhaps you're thinking of C++ or Objective C.  The last I
> know C didn't have inheritance.
> 
> SteveD
> 
> 
Sorry.  I was talking about mixing languages.  Ada and C (and 
not C++).  Not that I have many objections to using C++ as a 
small superset of C.  It's when the templates, etc. start 
showing up that I get upset.

No.  One of the things that C is really good at is replicating 
the utility of the PL/I based variables.  One of the things that 
it's really bad at is the horrendous amount of casting one must 
do.  And preprocessor code and pointer manipulation can make it 
actually less readable than either APL or Forth.

But for small routines, that are basically self contained 
modules, it is even easier than Ada, and if one needs to map the 
same area of memory with several arbitrary structures it appears 
to me to be much better.  (Well, my Ada experience is quite 
limited.)

What I was proposing was that the Ada classes would descend from 
a root, say, persistent, and that they would all implement a 
method to pass type & data information to a C routine that would 
manage the storage/retrieval from a disk file.  This would work, 
but appears a bit clumsy.  (Like LOTS clumsy!).

Ada.Streams_IO, however, seems to be a built in method for doing 
most of what I need.  The only problem is that when I'm reading 
the stuff back in I won't be able to use the file tags to tell 
Ada what kind of data I'm reading.  That won't be known at 
compile time.  So I'll need to build the kind of case switch 
that Tagged object types try to make obsolete.  It will be more 
the way that Ada83 handled tagged records.  What comes out will 
need to be a descendant of Persistant, Persistant will need to 
know about what methods all of it's sub-types can handle, unless 
I find that I need to do a full-fledged Meta Object Protocol 
(MOP), in which case I'll probably decide to use some language 
that has one already built into it.  Those things are beastly to  
implement.  And in that case, I'll want to call Ada routines 
from the overlying layer.  This will probably mean that they 
need to be compiled with C linking conventions. (Which is 
another reason to avoid C++ ... it's way of name munging is not 
portable.)

-- 
Charles Hixson

Copy software legally, the GNU way!
Use GNU software, and legally make and share copies of software.
See http://www.gnu.org
    http://www.redhat.com
    http://www.linux-mandrake.com
    http://www.calderasystems.com/
    http://www.linuxapps.com/



  reply	other threads:[~2001-06-22 17:33 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-19 20:39 Looping over a tagged record? M R Goodwin
2001-06-19 21:31 ` Pascal Obry
2001-06-19 21:32 ` Pascal Obry
2001-06-19 22:20   ` Samuel T. Harris
2001-06-19 23:45     ` mgoodwinSPAMMY
2001-06-20  1:33 ` Pat Rogers
2001-06-20  3:13   ` Pat Rogers
2001-06-20  2:58 ` DuckE
2001-06-20 13:15 ` Ted Dennison
2001-06-20 15:01   ` M. A. Alves
2001-06-21  2:36     ` DuckE
2001-06-21 10:14       ` M. A. Alves
2001-06-21 13:24         ` Pat Rogers
2001-06-21 17:08     ` Charles Hixson
2001-06-21 18:58       ` tmoran
2001-06-21 23:02         ` Charles Hixson
2001-06-22 19:04           ` B.Gaffney
2001-06-22 20:36             ` Pascal Obry
2001-06-22  2:18       ` DuckE
2001-06-22 17:33         ` Charles Hixson [this message]
2001-06-22 18:24           ` tmoran
2001-09-13  0:29           ` Gnat Windows load error tmoran
2001-09-13 18:15             ` Jerry van Dijk
2001-09-13 23:17               ` tmoran
2001-09-13  3:58           ` Ada web crawler tmoran
2001-11-17 21:50           ` ada.strings.bounded slice errors tmoran
2001-11-18 17:16             ` Florian Weimer
2001-11-18 19:31               ` tmoran
2001-11-19  7:12                 ` Florian Weimer
2002-02-08 20:55           ` How to get a traceback in Gnat 3.14p tmoran
2002-02-08 21:24             ` Pascal Obry
2002-02-08 22:28               ` tmoran
2002-02-11  0:10           ` How to use gnatelim in Gnat 3.14p? tmoran
2002-02-15 17:23           ` does gnatelim work? tmoran
2002-02-15 18:18             ` Stephen Leake
2002-02-15 21:58               ` tmoran
2002-02-18  1:31                 ` Stephen Leake
2002-04-15  3:05           ` Announce: .rc files with Gnat tmoran
2002-04-15 14:48             ` Ted Dennison
2002-05-25  7:06           ` slice'access? tmoran
2002-05-25 16:47             ` slice'access? Robert Dewar
2002-05-25 18:28               ` slice'access? tmoran
2002-05-25 20:20                 ` slice'access? Jeffrey Carter
2002-05-25 23:39                   ` slice'access? tmoran
2002-05-26 14:22                     ` slice'access? Robert Dewar
2002-09-30  1:54           ` 'write of bounded string? tmoran
2002-09-30 16:06             ` Stephen Leake
2002-10-27 23:01           ` phone# etc bdean
2002-10-28  3:04             ` tmoran
2002-11-06  3:14           ` A little Ada app tmoran
2002-11-06 11:37             ` Larry Kilgallen
2002-11-06 15:08             ` Ted Dennison
2002-11-06 18:02               ` tmoran
2001-06-21  3:09 ` Looping over a tagged record? gresset1
replies disabled

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