@@ -18,7 +18,7 @@ to send and receive more complex data types. If so, how can the device driver
18
18
support them?
19
19
20
20
We certainly don't want the clients to do unchecked conversions everywhere.
21
- That's error-prone, because it prevents the compiler from checking the usage,
21
+ That's error-prone, it prevents the compiler from checking the usage,
22
22
and makes clients responsible for what should be an internal implementation
23
23
detail.
24
24
@@ -608,19 +608,22 @@ Limited types do not support the stream I/O attributes by default, but
608
608
developers can define them. Note that this is not a problem for the
609
609
generic-based approach, because we declared the generic formal type as
610
610
:ada: `limited ` and wouldn't need to do anything within the generic that would
611
- contradict that.
612
- The client's generic actual type can then be either a limited type or not.
611
+ contradict that. The client's generic actual type can then be either a limited
612
+ type or not.
613
613
614
614
When multiple types are being sent and received, the sender and receiver must
615
615
be coordinated so that the next value consumed from the stream is of the type
616
616
expected by the receiver. For example, the next value in the stream might have
617
617
been written by the sender as a floating-point value, via
618
618
:ada: `Float'Write (...) `. The receiver must use :ada: `Float'Read(...) ` to
619
619
consume that value from the stream. Arguably, this is not really a *con *
620
- because it's true for any stream when multiple types are involved. It's even
621
- true across programming languages |mdash | see
620
+ because it's true for any stream when multiple types are involved. Even if we
621
+ used the generic-based approach, developers could instantiate the generic multiple
622
+ times with different types and send their values via the same port. With streams this
623
+ approach is as type-safe as it can be.
624
+ However, see
622
625
:ref: `Note #2 <Ada_In_Practice_Using Streams_Note_Generic_Dispatching_Constructor >`
623
- below.
626
+ below for a possible mitigation.
624
627
625
628
626
629
Relationship With Other Idioms
0 commit comments