comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: fyi, very interesting Ada paper OOP vs. Readability
Date: Thu, 21 Jun 2012 11:06:18 -0500
Date: 2012-06-21T11:06:18-05:00	[thread overview]
Message-ID: <jrvgpt$mqb$1@munin.nbi.dk> (raw)
In-Reply-To: jq68qj$de5$1@dont-email.me

"BrianG" <me@null.email> wrote in message news:jq68qj$de5$1@dont-email.me...
> On 05/30/2012 03:29 AM, Niklas Holsti wrote:
>> On 12-05-30 04:09 , BrianG wrote:
>>> On 05/11/2012 08:37 PM, Randy Brukardt wrote:
>>>> Ada should have had a "conversion" operator ("#" has been proposed), 
>>>> and
>>>> clearly Ada.Strings.Unbounded should use it. But that gets shot down 
>>>> every
>>>> time it is proposed (and it has been proposed for every language 
>>>> revision
>>>> other than Ada 2012); mainly because a minority think that "+" is 
>>>> perfectly
>>>> good for that. And another minority think that uses "+" on non-numeric 
>>>> types
>>>> is *disgusting*, so we can never get the operators added to packages. A
>>>> perfect impasse.
>>>>
>>> Why not unary "&", isn't that closer to the existing syntax?
>>>
>> Please, not "&", that would make calls look too much like calls in C
>> with pointer parameters. "&" being the C "address-of" operator. "&" is
>> also a large glyph, as tall as upper-case letters, making a following
>> identifier harder to recognize at a glance. How about "~"? Meaning, I
>> want "approximately" this value, but converted as necessary.
>>
> So I guess we should ban 'C' as a variable name too.  Who cares what looks 
> like C?  Does that somehow bring along with it the problems in C? How?
>
> We already have A := "This" & " That", Why not also B := &"The other", 
> that makes it perfectly analogous with D := 1 + 2 and E := +3.  (Yes, I 
> skipped C :-)  Function "&" already has an established meaning in Ada, why 
> not use it for a (somewhat) similar purpose?

That makes sense if you are *only* interested in conversions of strings. "&" 
makes no more sense for numbers than "+" makes sense for strings. The intent 
of the proposed "#" operator is that it be for the conversion of any type to 
any other type.

For instance, I could imagine using "#" to describe conversions of array of 
Element to vector of Element. Neither "+" nor your proposed "&" makes sense 
for that. The basic idea is that "#" would provide the effect of a 
user-defined type conversion.

An alternative idea that I've occassionally thought about has been to 
directly allow user-defined (value) type conversions. That is, provide a 
mechanism to allow the existing type conversion syntax to call a function in 
cases where there isn't already a defined conversion. This would work 
something like user-defined indexing does.

Then,

    Var := Unbounded_String("abc");

would be possible. (But note that this could end up nearly as wordy as the 
existing mechanism.)

                                          Randy.






  reply	other threads:[~2012-06-21 16:06 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-09 13:06 fyi, very interesting Ada paper OOP vs. Readability Nasser M. Abbasi
2012-05-09 13:19 ` Nasser M. Abbasi
2012-05-09 13:36   ` Dmitry A. Kazakov
2012-05-09 13:39     ` Patrick
2012-05-09 13:55       ` Egil Høvik
2012-05-10  2:33 ` Randy Brukardt
2012-05-10  6:33   ` Simon Wright
2012-05-12  0:37     ` Randy Brukardt
2012-05-30  2:09       ` BrianG
2012-05-30  7:29         ` Niklas Holsti
2012-05-30  7:54           ` Yannick Duchêne (Hibou57)
2012-05-30  7:59             ` Dmitry A. Kazakov
2012-05-30 12:45               ` stefan-lucks
2012-05-30 13:12                 ` Dmitry A. Kazakov
2012-05-30 19:11           ` Jeffrey Carter
2012-05-30 23:00           ` BrianG
2012-06-21 16:06             ` Randy Brukardt [this message]
2012-05-10  8:43   ` Maciej Sobczak
2012-05-15  6:16     ` Simon Wright
2012-05-10 11:46   ` Dmitry A. Kazakov
2012-05-10 14:23     ` Georg Bauhaus
2012-05-10 14:47       ` Nasser M. Abbasi
2012-05-10 15:11         ` Adam Beneschan
2012-05-10 16:06         ` Georg Bauhaus
2012-05-10 18:41           ` Niklas Holsti
2012-05-11  8:20             ` Georg Bauhaus
2012-05-10 20:11           ` Nasser M. Abbasi
2012-05-10 21:17             ` tmoran
2012-05-10 18:07         ` Jeffrey Carter
2012-05-11  7:32         ` Maciej Sobczak
2012-05-10 12:31 ` J-P. Rosen
2012-05-10 13:32 ` Yannick Duchêne (Hibou57)
2012-05-10 13:38   ` Nasser M. Abbasi
2012-05-10 23:42     ` Zhu Qun-Ying
2012-05-11  6:05   ` J-P. Rosen
2012-05-11  3:01 ` NatarovVI
2012-05-11  7:14   ` Dmitry A. Kazakov
2012-05-11  7:32     ` Nasser M. Abbasi
2012-05-11  7:58       ` Dmitry A. Kazakov
2012-05-13  3:11         ` NatarovVI
2012-05-13 10:03           ` Georg Bauhaus
2012-05-16 15:00             ` NatarovVI
2012-05-16 18:01               ` Georg Bauhaus
2012-05-21 16:35                 ` NatarovVI
2012-05-21 17:56                   ` Georg Bauhaus
2012-05-23 16:01                     ` NatarovVI
2012-05-23 16:12                       ` NatarovVI
2012-05-16 15:31     ` NatarovVI
2012-05-16 16:40       ` Dmitry A. Kazakov
2012-05-21 17:23         ` NatarovVI
2012-05-21 18:53           ` Dmitry A. Kazakov
2012-05-21 19:21             ` Nasser M. Abbasi
2012-05-23 17:59               ` NatarovVI
2012-05-23 18:45                 ` Dmitry A. Kazakov
2012-05-23 17:39             ` NatarovVI
2012-05-23 18:39               ` Dmitry A. Kazakov
2012-05-11  3:09 ` NatarovVI
replies disabled

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