comp.lang.ada
 help / color / mirror / Atom feed
* exceptions and streams
@ 1998-10-30  0:00 Bernd Ragutt
  1998-10-31  0:00 ` dewarr
  0 siblings, 1 reply; 8+ messages in thread
From: Bernd Ragutt @ 1998-10-30  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2272 bytes --]

Hello,

I tried to write (and read) exception occurrences to a stream;
with the Gnat-Compiler I succeeded,
with the Apex-Compiler I failed.

I think there is a contradiction between RM 11.4.1 (16) and RM 13.13.2 (36).

Any comments?

Bernd Ragutt
----------------------
BerndRagutt@csi.com


--*******************************************************************

Ada95-Code
Exceptions.Exception_Occurrence'Write
 (Stream => As_Excecption_Stream, Item => An_Exception_Occurrence);

GNAT 3.10 / NT
... compiles and executes the code without an error message.

Rational APEX 3.0 AIX
>>> Line 37: Exceptions.Exception_Occurrence'Write (As_Excecption_Stream,
An_Excecption_Occur);
*** Exceptions.Exception_Occurrence'Write must be specified via an attribute
definition

RM 11.4.1 (16)
The implementation of the Write attribute (see 13.13.2) of
Exception_Occurrence shall [!!!] support writing a representation of an
exception occurrence to a stream; the implementation of the Read attribute
of Exception_Occurrence shall support reconstructing an exception occurrence
from a stream (including one written in a different partition).

RM 13.13.2 (2)
For every subtype S of a specific type T, the following attributes [S�Write,
S�Read] are defined.

RM 13.13.2 (36)
The stream-oriented attributes may be specified for any type via an
attribute_definition_clause. All nonlimited types have default
implementations for these operations. An attribute_reference for one of
these attributes is illegal if the type is limited, unless the attribute has
been specified by an attribute_definition_clause. For an
attribute_definition_clause specifying one of these attributes, the subtype
of the Item parameter shall be the base subtype if scalar, and the first
subtype otherwise. The same rule applies to the result of the Input
function.

AI95-00047/03, 96-02-06
...
The wording of 13.13.2(2) is misleading.  Limited types don't have a
default implementation for the Read and Write attributes, per 13.13.2(36).
Clearly 13.13.2(2) should be reworded to make it clear that although
the attributes are in some sense "defined," it is illegal to evaluate
them for limited types unless the user specifies them.
...
--*******************************************************************






^ permalink raw reply	[flat|nested] 8+ messages in thread
* Exceptions and Streams
@ 2006-05-20 16:03 REH
  2006-05-21 20:40 ` Simon Wright
  0 siblings, 1 reply; 8+ messages in thread
From: REH @ 2006-05-20 16:03 UTC (permalink / raw)


I have a stream class that just writes the stream data to an array.
This is used to marsal parameters to make distributed calls in another
address space.  I have two questions about streams:

1) Does 11.4.1 (16) of the RM (see below) say that I can stream an
exception occurrance to another address space and re-raise it?  Note
that I am not using "partitions" as defined in the  Distributed Ada
Annex, but just separate address spaces.

"The implementation of the Write attribute (see 13.13.2) of
Exception_Occurrence shall support writing a representation of an
exception occurrence to a stream; the implementation of the Read
attribute of Exception_Occurrence shall support reconstructing an
exception occurrence from a stream (including one written in a
different partition)."

2) Is there an easy way to determine the number of elements an object
of a given type will write to a stream before hand?  I need to know how
big to make the array to hold all a procedures parameters, and I don't
want to have to hard-code things like dupe vector sizes.

Much appreciated,

REH




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-05-22 15:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-30  0:00 exceptions and streams Bernd Ragutt
1998-10-31  0:00 ` dewarr
1998-11-02  0:00   ` Bernd Ragutt
1998-11-03  0:00     ` dewar
1998-11-03  0:00       ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
2006-05-20 16:03 Exceptions and Streams REH
2006-05-21 20:40 ` Simon Wright
2006-05-22 15:11   ` REH

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