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: border1.nntp.dca3.giganews.com!backlog3.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Text_IO, was: Re: Something I don't understand Date: Tue, 18 Feb 2014 09:14:26 +0200 Organization: Tidorum Ltd Message-ID: References: <4a3e55f6-9f54-4084-9f37-96efd4b0d349@googlegroups.com> <0b358700-871b-4603-addd-65e07c7d59e5@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net YWk7VujYh1OoQ9/Qn8CB2gjmfM6FP7ZnbOR2/RLgMLWzUmDg0l Cancel-Lock: sha1:sUGhKPzqOcvh5r/yFUH51eb7DmY= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: X-Original-Bytes: 3961 Xref: number.nntp.dca.giganews.com comp.lang.ada:184982 Date: 2014-02-18T09:14:26+02:00 List-Id: On 14-02-17 21:55 , Dmitry A. Kazakov wrote: > On Mon, 17 Feb 2014 19:42:07 +0200, Niklas Holsti wrote: > >> On 14-02-17 19:17 , Dmitry A. Kazakov wrote: >>> On Mon, 17 Feb 2014 18:59:43 +0200, Niklas Holsti wrote: >>> >>>> I think that the present method of concatenating strings or using >>>> several Puts is good; what is needed is to extend or replace the 'Image >>>> attribute with similar value-to-string functions which are more >>>> controllable, flexible, and work also for composite types. >>> >>> Except that all these need to be MD primitive operations. There is no way >>> to solve this without MD. >> >> Why multiple dispatch? > > Print (Display, Shape) > > is a textbook example of MD. > >> Which would be the multiple controlling >> parameters? > > File and Value > >> I think only the input value should be controlling; perhaps >> you think that the output channel/device should also be controlling? > > Certainly so. Consider ASCII_File, UTF8_File, Gtk_Text_Buffer_Record and so > on. That could be done using overloading based on the expected type of the Image function result, instead of multiple dispatch. Of course that would require different types to represent ASCII strings and UTF8 strings, etc. Using different types for different kinds of strings would be a good thing anyway, IMO (but I know that this causes problems with a combinatorial explosion of the number of predefined subprograms involving strings). > You cannot convert to string before sending it out, because ASCII will > use E for power of 10, UTF8 will use superscript characters for it, and > Gtk_Text_Buffer_Record will do the GTK markup language. Hrm. I'm not at all sure that I would want such different formatting for different output channels to happen automatically. For one thing, using superscripts for exponents would prevent or complicate the user's copy-paste operations, for example copying the output of a Float number into a calculator accessory. There should really be a type "Text" that represents text, with all its complications of encoding, formatting, styles, fonts, lines, paragraphs, tabulation, indentation, language, ... True, that is horribly complex, but that's reality now. It is debatable if this should be in the language, or in toolkits (GUI or others). Probably some core part of it should be in the language and the rest in a toolkit or in an optional Annex to the language. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .