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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b076e6315fd62dc5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.196.232 with SMTP id ip8mr90345pbc.6.1340294783158; Thu, 21 Jun 2012 09:06:23 -0700 (PDT) MIME-Version: 1.0 Path: l9ni3720pbj.0!nntp.google.com!news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: fyi, very interesting Ada paper OOP vs. Readability Date: Thu, 21 Jun 2012 11:06:18 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1340294781 23371 69.95.181.76 (21 Jun 2012 16:06:21 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 21 Jun 2012 16:06:21 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Response Date: 2012-06-21T11:06:18-05:00 List-Id: "BrianG" 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.