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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable 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-23 15:49:31 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stueberl.de!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "Alexandre E. Kopilovitch" Newsgroups: comp.lang.ada Subject: Re: U : Unbounded_String := "bla bla bla"; (was: Is the Writing...) Date: Fri, 24 Oct 2003 01:11:21 +0400 (MSD) Organization: Cuivre, Argent, Or Message-ID: References: <3F907513.40901@comcast.net> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: melchior.cuivre.fr.eu.org 1066949253 36889 80.67.180.195 (23 Oct 2003 22:47:33 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Thu, 23 Oct 2003 22:47:33 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: <3F907513.40901@comcast.net>; from "Robert I. Eachus" at Fri, 17 Oct 2003 23:03:01 GMT X-Mailer: Mail/@ [v2.44 MSDOS] X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:1554 Date: 2003-10-24T01:11:21+04:00 Robert I. Eachus wrote: > Randy Brukardt wrote: > > ... > > 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. > > Ouch! I forgot about that case when explaining why the non-literal > conversions would be ambiguous. Having worked on this though, you can > handle it as you say by a completely new package with different > overloadings of "&"--which won't happen. Actually there is no need for completely new package with different overloadings of "&" - just one little new pragma seems sufficient: pragma Non_Literal_Argument(subroutine-name, parameter-name); stating (immediately following the function's spec) that actual argument for this parameter cannot be a literal. That is, the whole spec for that "&" will be: function "&" (Left : in Unbounded_String; Right : in String) return Unbounded_String; pragma Non_Literal_Argument("&", Right); and that unhappy ambiguity disappears forever. Alexander Kopilovitch aek@vib.usr.pu.ru Saint-Petersburg Russia