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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e1bb9627c57b7d5b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-17 13:25:20 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: U : Unbounded_String := "bla bla bla"; (was: Is the Writing...) Date: Fri, 17 Oct 2003 15:26:39 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3F86F5FE.4050104@comcast.net> <3F88E067.30209@comcast.net> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:1099 Date: 2003-10-17T15:26:39-05:00 List-Id: "Robert I. Eachus" wrote in message news:3F88E067.30209@comcast.net... > Now if you want to recommend that in Ada 200X, package > Ada.Strings.Unbounded include: > > function "+" (Source : in String) return Unbounded_String > renames To_Unbounded_String; > function "+" (Source : in Unbounded_String) return String > renames To_String; > > I will certainly support that. I don't really know why they were left > out of Ada.Strings.Unbounded while They were briefly in AI-301's improvements to Ada.Strings, but enough people think that they're ugly that they were taken out. Earlier, Robert said: > And as I said, I think adding implicit conversion of string literals to > and from Unbounded_String would work. No, actually it wouldn't. It would make a lot of existing code ambiguous. A : Unbounded_String; B : Unbounded_String := A & "something"; Since the string literal could have either type String or Unbounded_String, and "&" can have operands of either type, the expression would become ambiguous. It's virtually impossible to "improve" the current Ada.Strings.Unbounded. We'd have to create a whole new package for that, and that would be a tough sell for the standard. My preference would be a package in which String occurs only in the To_xxx routines, along with a way to use string literals directly as Unbounded_Strings. (Non-literal conversions from String should be explicit.) That would be a much more consistent abstraction than Ada.Strings.Unbounded. But we're pretty much stuck with Ada.Strings.Unbounded as it is. Randy.