comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Text_IO, was: Re: Something I don't understand
Date: Mon, 17 Feb 2014 20:55:12 +0100
Date: 2014-02-17T20:55:12+01:00	[thread overview]
Message-ID: <swsor6oximy0$.zglgiwn94pd3.dlg@40tude.net> (raw)
In-Reply-To: bmevvfFpnd0U1@mid.individual.net

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. 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.
 
>>> Perhaps
>>> something analogous to the stream attributes, but with the ability to
>>> control the output format at each invocation, which is not possible with
>>> the stream attributes.
>> 
>> I don't think there is any need in having formats. A few formatting
>> parameters could be passed along to Image or equivalent.
> 
> Well, parameters and options is what I meant. For example, the ability
> to specify blank fill, zero fill, center/left/right alignment, digit
> group spacing (1 123 456,00 or 1_123_456.00), etc.

Yes, however, from experience, it quickly gets overcomplicated. I customary
use Input_Parameters and Output_Parameters objects as you suggest below.
They must be controlled as well because you want to be able to extend them.

>> Environment settings (e.g. locale) should come from the rendering surface
>> object. No need to specify them at all. This is how stuff like fonts,
>> colors etc is handled in GUI.
> 
> A "rendering surface" is not always available at the point where the
> string is generated.

String itself is such a surface. That is the point of having it controlled.
You can replace it with whatever type, e.g. File, Stream etc. And string
itself is a Universe of types because of encodings.

> There could be a private predefined type for such settings. A value of
> that type could be given as a parameter in the Image call to set the
> default format (which could then be overridden if the Image call also
> has some specific format parameters).

Yes of course, but this is usually another set of parameters. Less volatile
parameters, such as whether to use '.' or ',' to introduce fraction belong
to the surface.

> A GUI toolkit could have a
> function to to return a suitable value of this type from a "rendering
> surface" object.

Possible but tedious.

> I don't see why this, or the output channel, should be
> a controlling parameter.

Because you cannot predict all possible combinations of and because it is a
huge wasting of human and computational resources as no given application
will ever use more than 1% of it.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2014-02-17 19:55 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 23:57 Something I don't understand Laurent
2014-02-14  0:18 ` adambeneschan
2014-02-14  7:05   ` Charles H. Sampson
2014-02-15 15:27   ` Laurent
2014-02-15 19:10     ` Laurent
2014-02-15 20:05       ` Niklas Holsti
2014-02-15 21:16         ` Laurent
2014-02-15 21:40       ` Jeffrey Carter
2014-02-16  1:39       ` Robert A Duff
2014-02-16  9:08         ` Text_IO, was: " Simon Clubley
2014-02-16  9:43           ` Dmitry A. Kazakov
2014-02-16 16:57             ` Dennis Lee Bieber
2014-02-16 16:17           ` Robert A Duff
2014-02-17 12:52             ` Simon Clubley
2014-02-17 15:32               ` G.B.
2014-02-17 15:35                 ` G.B.
2014-02-17 17:34                 ` Mike H
2014-02-17 16:59               ` Niklas Holsti
2014-02-17 17:17                 ` Dmitry A. Kazakov
2014-02-17 17:42                   ` Niklas Holsti
2014-02-17 19:55                     ` Dmitry A. Kazakov [this message]
2014-02-18  7:14                       ` Niklas Holsti
2014-02-18  8:40                         ` Dmitry A. Kazakov
2014-02-18  9:00                           ` Niklas Holsti
2014-02-18  9:31                             ` Dmitry A. Kazakov
2014-02-19  8:36                               ` Niklas Holsti
2014-02-19  9:40                                 ` Dmitry A. Kazakov
2014-02-19 13:20                                   ` Niklas Holsti
2014-02-19 14:13                                     ` Dmitry A. Kazakov
2014-02-19 15:37                                       ` Georg Bauhaus
2014-02-19 16:32                                         ` Laurent
2014-02-19 17:46                                           ` Simon Clubley
2014-02-20  2:39                                         ` Dennis Lee Bieber
2014-02-20 11:44                                           ` G.B.
2014-02-19 21:45                                       ` Niklas Holsti
2014-02-20  9:52                                         ` Dmitry A. Kazakov
2014-02-20 18:19                                           ` Niklas Holsti
2014-02-19 15:06                                     ` Robert A Duff
2014-02-19 17:03                                       ` Niklas Holsti
2014-02-19 22:30                                         ` Robert A Duff
2014-02-17 18:13                 ` Simon Clubley
2014-02-17 20:09                   ` Dmitry A. Kazakov
2014-02-18  7:50                     ` Georg Bauhaus
2014-02-18  8:28                       ` Dmitry A. Kazakov
2014-02-17 20:22                   ` Niklas Holsti
2014-02-18  0:50                     ` Simon Clubley
2014-02-18  6:56                       ` Niklas Holsti
2014-02-18  8:04                         ` Georg Bauhaus
2014-02-19 22:01                     ` Robert A Duff
2014-02-20  8:25                       ` Dmitry A. Kazakov
2014-02-20 15:54                         ` Robert A Duff
2014-02-20 17:54                           ` Dmitry A. Kazakov
2014-02-20 20:45                       ` Niklas Holsti
2014-02-19 21:52                   ` Robert A Duff
2014-02-20  0:50                     ` Simon Clubley
2014-02-19 21:46                 ` Robert A Duff
2014-02-20  0:09                   ` Jeffrey Carter
2014-02-20  1:09                     ` Simon Clubley
2014-02-20  7:06                       ` Niklas Holsti
2014-02-20 13:05                         ` Simon Clubley
2014-02-20 11:51                       ` G.B.
2014-02-20 12:53                         ` Simon Clubley
2014-02-21 11:50                       ` Brian Drummond
2014-02-23 21:37                         ` AdaMagica
2014-02-23 23:23                           ` Bill Findlay
2014-02-24  4:29                           ` AdaMagica
2014-02-24 12:22                           ` Brian Drummond
2014-02-24 19:03                             ` AdaMagica
2014-02-20 20:02                   ` Niklas Holsti
2014-02-19 21:15               ` Robert A Duff
2014-02-19 22:01                 ` Simon Clubley
2014-02-16 14:50         ` Mike H
2014-02-17 16:09         ` Laurent
2014-02-17 17:42           ` Mike H
2014-02-18  1:05             ` Dennis Lee Bieber
2014-02-17 22:31           ` Jeffrey Carter
2014-02-19 12:51             ` Laurent
replies disabled

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