comp.lang.ada
 help / color / mirror / Atom feed
From: sk <sknipe@ktc.com>
Subject: Re: ADA and return functions (Strings)
Date: Mon, 20 May 2002 21:51:52 -0500
Date: 2002-05-20T21:51:52-05:00	[thread overview]
Message-ID: <mailman.1021949581.28481.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: acasfj$acg$1@nh.pace.co.uk

Hi,

MDC :
> ... Integer'Spaceless_Image ...

I was thinking of for more complex types, 
timestamps for example. 

A "for Time'Image use My_Time_Image" might allow
for several possibilities :

1) I want date only.
2) I want time only
3) I want yyyy-mm-dd format
4) I want mm-dd-yyyy format
5) ... etc

Instead of asking the Ada language to standardize a
date/time image format which will not meet all needs, 
allow an 'Image substitution.

It could be tricky, but I think it might have less 
impact on the language than adding special attributes, 
such as "Spaceless_Image", to the predefined set of 
attributes.

In many ways, the 'Image and 'Value attributes have
parallels to the 'Read and 'Write attributes in terms 
of allowing the caller to define the presentation of
I/O data formats.

I realize of course, that nothing is really gained by 
'Image and 'Value substitution since they are directed
at the definite string type and 'Read and 'Write are 
directed at the abstract stream, but it could provide
a solution to the statement 

dewar@gnat.com (Robert Dewar) :
> ... But we are stuck now because people depend on 
> the existing annoying definition.

Let "people" depend upon their own definition, let the 
language worry about more critical things.

Another possible benefit is that one could define a 
simple "Hex_Image" function for example. One could 
then substitute with 

"for My_Integer_Type'Image use Hex_Image;" 

instead of having to instantiate an Ada.Text_Io.Integer_Io
and setting default base etc. and then use the string 
specific "Put" (which requires a constrained string, and
was a secondary point of another thread a week or two ago).

-- 
-------------------------------------
-- Merge vertically for real address
-------------------------------------
s n p @ t . o
 k i e k c c m
-------------------------------------



  reply	other threads:[~2002-05-21  2:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-19  7:20 ADA and return functions (Strings) ProLogic
2002-05-19 10:38 ` David C. Hoos, Sr.
2002-05-19 14:14   ` ProLogic
2002-05-19 14:30   ` Robert Dewar
2002-05-19 20:23     ` sk
2002-05-20 13:08       ` Marin David Condic
2002-05-21  2:51         ` sk [this message]
2002-05-21 10:50           ` John English
2002-05-21 12:52           ` Marin David Condic
2002-05-21 14:39           ` Ted Dennison
2002-05-21 16:27             ` Jean-Pierre Rosen
2002-05-21 20:39             ` sk
     [not found]             ` <3CEAB094.6B9E14F7@myob.com>
2002-05-21 21:07               ` sk
2002-05-21 19:52         ` sk
2002-05-19 20:27     ` David C. Hoos, Sr.
2002-05-20  3:06       ` Robert Dewar
2002-05-20 15:29         ` Kevin Cline
2002-05-20 17:16           ` Larry Kilgallen
2002-05-19 21:06 ` Jeffrey Carter
2002-05-20  1:58   ` tmoran
2002-05-20  2:28     ` David C. Hoos, Sr.
2002-05-20  3:05       ` tmoran
2002-05-20  3:35         ` David C. Hoos, Sr.
replies disabled

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