From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,228dbf2f126edf08 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-21 07:39:07 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dennison@telepath.com (Ted Dennison) Newsgroups: comp.lang.ada Subject: Re: ADA and return functions (Strings) Date: 21 May 2002 07:39:07 -0700 Organization: http://groups.google.com/ Message-ID: <4519e058.0205210639.59c72ebb@posting.google.com> References: <3ce75220@news.comindico.com.au> <5ee5b646.0205190630.237196b3@posting.google.com> NNTP-Posting-Host: 65.115.221.98 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1021991947 19379 127.0.0.1 (21 May 2002 14:39:07 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 21 May 2002 14:39:07 GMT Xref: archiver1.google.com comp.lang.ada:24466 Date: 2002-05-21T14:39:07+00:00 List-Id: sk wrote in message news:... > Instead of asking the Ada language to standardize a > date/time image format which will not meet all needs, > allow an 'Image substitution. It has been suggested here before, yes. I understand that it was even proposed for Ada95, but the cost/benifit ratio was deemed not low enough. > 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. If one were to use the same mechanisim that those attributes use, then the existing language rules would diallow overriding these attributes anywhere but the compilation unit (typically package spec) in which their types are declared. Thus you still could not use this mechanism to "fix" the leading spaces on the predefined types. However, you could define your own types derived from them which have more sensible images. So you could make something like: type DD_MM_YY_HHMMSS is new Ada.Calendar.Time; type Day_Month_Year is new Ada.Calendar.Time; for DD_MM_YY_HHMMSS'image use DD_MM_YY_HHMMSS_Image; ... Ada.Text_IO.Put_Line ("Basic Stamp: " & DD_MM_YY_HHMMSS'image (DD_MM_YY_HHMMSS (Ada.Calendar.Clock))); Ada.Text_IO.Put_Line ("Readable Date Stamp: " & Day_Month_Year'image (Day_Month_Year (Ada.Calendar.Clock)));