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-15 10:11:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!easynet-quince!easynet.net!teaser.fr!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: Wed, 15 Oct 2003 20:59:00 +0400 (MSD) Organization: Cuivre, Argent, Or Message-ID: References: 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 1066237341 4328 80.67.180.195 (15 Oct 2003 17:02:21 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Wed, 15 Oct 2003 17:02:21 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: ; from "Mark A. Biggar" at Tue, 14 Oct 2003 20:26:16 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:907 Date: 2003-10-15T20:59:00+04:00 Mark A. Biggar wrote: > > for Unbounded_String'Literal_Conversion use To_Unbounded_String; > > > > (I understand that the same thing we can say using new pragma Literal_Conversion: > > > > pragma Literal_Conversion (Unbounded_String, To_Unbounded_String); > > > > but I think that an attribute is somehow better here). > > With either of the above suggestions you probably also need to specify > the type of literal allowed as well. This would allow for multiple > different types of literals to be used. I don't know whether it makes sense to have multiple types of literals for some private type. Are there appropriate examples? But anyway, I see no problems with that in proposed notation: you have just provide appropriate functions for conversion, with the same name (similarly to usual overloading): type Flex is private; for Flex'Literal_Conversion use To_Flex; function To_Flex(Source : String) return Flex; function To_Flex(Source : Integer) return Flex; Compiler will use one of those conversion functions depending on the literal type it encountered. And I think that any other way to tell the compiler an information for this purpose can't be better. My concern is quite opposite: I'd like have a control for blocking such overloadings (thus denying an opportunity for multiple literal types for a given type), including those that may emerge within a derivation of a new type; I don't know whether it is possible - to control that overloading - and it worries me slightly. Although I don't count all that multiplicity of literal types as too significant matter. Alexander Kopilovitch aek@vib.usr.pu.ru Saint-Petersburg Russia