comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: Distributed system portability
Date: Tue, 31 Jul 2001 20:26:02 GMT
Date: 2001-07-31T20:26:02+00:00	[thread overview]
Message-ID: <uvE97.12979$ar1.41484@www.newsranger.com> (raw)
In-Reply-To: QAC97.18171$Kd7.10872006@news1.rdc1.sfba.home.com

In article <QAC97.18171$Kd7.10872006@news1.rdc1.sfba.home.com>, tmoran@acm.org
says...
>
>>you have to do *all* this (including implementing all the stream attributes for
>>*all* types that will ever be used with the stream, excepting perhaps some
>>composite types). With that much work involved, the streams aren't really
>>providing you much except the supposedly nice syntax.
>  (I haven't tried this but ...) I think you just have to implement the
>base types, and you need do it only once.  So if you are going to be

I have actually done some cross-platform (and cross-vendor) stream work. The
approach you mention has the following problems:

a) Not all discrete types are predefined. Integer types need not be derived from
Integer, and then there's modular types and enumerations. I'd particularly
expect to see different sizes used for enumerations. Some compilers might put
small ones in a byte, while others would use whatever their machine word is.

b) 'Output, 'Input, 'Class'Output, and 'Class'Input must deal with discriminants
and unconstrained arrays. The standard says the discriminant/array length has to
be written first, but says nothing about how many bytes are used to do it. The
discriminant should probably get written using its type's 'Write, but there is
no such thing for unconstrained array lengths. Thus you must rewrite 'Input,
'Output, 'Class'Input, and 'Class'Output for all such types (or at least all
unconstrained array types, and the 'Write for all the discriminats on the
discriminated ones).

c) 'Class'Output and 'Class'Input on tagged types also have to deal with the
tag. This is done using Tags.Internal_Tag. You can specify the external tag for
a tagged type, but not the internal tag. Thus in order to write tagged types
portably, you have to provide your own version of 'Class'Output and 'Class'Input
for every tagged type. Among other nasty problems, this involves creating an
algorithm that can come up with a portable unique tag for any type that might
ever get derived from your tagged type. Think on that one for a while...

d) One of the compilers I tried this on would not allow attribute definition
clauses outside of the declarative section that contained the type in question's
definition. That means that any clause for the predefined types would have to be
written in Standard (which you cannot change, as per the standard). I don't know
if this was allowable behavior, required behavior, or a bug.

e) The streams themselves have to be implemented portably (eg: a series of
Ada.Streams.Write's on one outputs the same bit pattern in the same order that
it does on any other). This is mostly only a problem with user-created streams,
as the predefined ones don't seem to leave much room for internal data
manipulation.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



  parent reply	other threads:[~2001-07-31 20:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-29 17:18 Distributed system portability Darren New
2001-07-30  8:00 ` Pascal Obry
2001-07-31  7:23   ` Frank
2001-07-31 16:35     ` Pascal Obry
2001-07-30 11:22 ` Thierry Lelegard
2001-07-30 13:05   ` Larry Kilgallen
2001-07-30 16:12     ` Thierry Lelegard
2001-07-30 21:39       ` Ted Dennison
2001-07-30 22:28         ` tmoran
2001-07-31 17:36           ` Ted Dennison
2001-07-31 18:15             ` tmoran
2001-07-31 18:55               ` Marin David Condic
2001-07-31 20:26               ` Ted Dennison [this message]
2001-07-31  7:44         ` Ole-Hjalmar Kristensen
2001-07-30 15:57 ` Marin David Condic
2001-07-30 17:17   ` Darren New
replies disabled

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