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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Clubley Newsgroups: comp.lang.ada Subject: Re: Your wish list for Ada 202X Date: Sun, 30 Mar 2014 13:46:41 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <7f1c01c5-3563-4b94-9831-152dbbf2ecdc@googlegroups.com> Injection-Date: Sun, 30 Mar 2014 13:46:41 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="e458ff8b81bc0c159989eb0e36c6e372"; logging-data="6813"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VNgD0q3M0Cpyg/5OEoxa7dEPTtQkiNG0=" User-Agent: slrn/0.9.8.1 (VMS/Multinet) Cancel-Lock: sha1:dSpUCRpA+wrZI8LqR0w95jiorgA= Xref: news.eternal-september.org comp.lang.ada:19042 Date: 2014-03-30T13:46:41+00:00 List-Id: On 2014-03-30, francois_fabien@hotmail.com wrote: > > One wish to ease Input/output : > To have some equivalent of C primitive : printf("%c %c %c %c %c \n %c %c %c %c %c \n", > We have just had that discussion a couple of weeks or so ago. :-) I also would like to see something like that in Ada, but I believe the actual formatting is a attribute of the data type and is not something which should be implemented within a I/O package as such. My general idea is that when you define a data type, you also add support for External_To_Internal and Internal_To_External conversions to the data type. At runtime, the Ada version of printf would call the Internal_To_External support code within the data type along with the fragment of the format for the entity in question (and which could include a optional display length and precision). Either a exception would be raised (if the requested conversion was invalid) or the formatted output would be returned to the Ada version of printf ready for direct inclusion in the output buffer. As was pointed out the last time I suggested this, if the format string was a literal, you could even check this at compile time, just as gcc does for a C program. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world