comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Little tutorial about streams
Date: Mon, 28 Feb 2011 21:48:19 -0600
Date: 2011-02-28T21:48:19-06:00	[thread overview]
Message-ID: <ikhqa5$7tr$1@munin.nbi.dk> (raw)
In-Reply-To: f8e7ccbf-a966-4568-9f0d-8e9e38f37dc6@glegroupsg2000goo.googlegroups.com

"mockturtle" <framefritti@gmail.com> wrote in message 
news:f8e7ccbf-a966-4568-9f0d-8e9e38f37dc6@glegroupsg2000goo.googlegroups.com...
>Dear.all,
>remembering my initial difficulties with streams (I self-taught Ada, using 
>few tutorials and lots of experiments before >landing to the RM), I decided 
>to write a page (my first one, so be patient :-) of the Wikibook with a 
>little stream >tutorial
>
>http://en.wikibooks.org/w/index.php?title=Ada_Programming/Input_Output/Stream_Tutorial

Looks generally good.

The little table under "Serialization functions" seems confusing, since it 
uses "composite" for Input and Output. But of course you can use Read and 
Write for "composite" types. It seems the intent is to be more informal 
(since "simple" is used rather than "elementary", which is good as there are 
no elementary class-wide types); may I suggest that the other entries use 
"complex" rather than "composite"? (Or some word meaning the same, if the 
confusion with "complex" numbers is a concern.)

In the text under "Write attribute", we have:

Clearly, the default implementation, being dependent on the machine and 
compiler, can be useful only if the data is written and read by programs 
compiled with the same compiler. If the data, for example, is to be sent 
across the network and read by a program written in another language, 
running on an unknown architecture, it is important for the programmer to 
control the format of the data sent over the wire. Because of this exigence, 
Ada allows the programmer to override S'Write (and the other stream-related 
functions described in the following), using an attribute definition clause 
(RM 13.3):

I had to get a dictionary to figure out what the word "exigence" means. 
Probably best to use a simpler word here; no need to make a tutorial harder 
to read than needed. I'd probably use "requirement" or "need" instead. (I 
didn't edit this as I think it is important for the author to consider their 
intention; I may have missed it altogether.)

It might make sense to mention that you can also specify these subprograms 
with an aspect clause in Ada 2012 (and indeed this will be preferred for 
most uses to the older attribute definition clause). But perhaps that's out 
of bounds here.

Finally, there might be some value to mentioning the use of 
Generic_Dispatching_Constructor to build user-defined class-wide Input 
routines. But maybe that is too advanced of a topic??

                             Randy.






  parent reply	other threads:[~2011-03-01  3:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 17:00 Ann: Little tutorial about streams mockturtle
2011-02-28 20:32 ` Ludovic Brenta
2011-03-01  3:48 ` Randy Brukardt [this message]
2011-03-01  9:54   ` AdaMagica
2011-03-01 10:16   ` Dmitry A. Kazakov
2011-03-01 13:56     ` Simon Wright
2011-03-01 14:38       ` Dmitry A. Kazakov
2011-03-04 20:58         ` mockturtle
2011-03-05  1:08           ` Shark8
2011-03-05  1:35           ` Randy Brukardt
replies disabled

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