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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no 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-20 19:53:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!213.56.195.71!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: sk Newsgroups: comp.lang.ada Subject: Re: ADA and return functions (Strings) Date: Mon, 20 May 2002 21:51:52 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <3ce75220@news.comindico.com.au> <5ee5b646.0205190630.237196b3@posting.google.com> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1021949582 5361 137.194.161.2 (21 May 2002 02:53:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 21 May 2002 02:53:02 +0000 (UTC) Return-Path: X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19-4.3mdk i686) X-Accept-Language: en Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:24447 Date: 2002-05-20T21:51:52-05:00 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 -------------------------------------