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-14 10:34:35 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stueberl.de!teaser.fr!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: Tue, 14 Oct 2003 21:11:39 +0400 (MSD) Organization: Cuivre, Argent, Or Message-ID: References: <3F8B00F6.1050206@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 1066152731 42017 80.67.180.195 (14 Oct 2003 17:32:11 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Tue, 14 Oct 2003 17:32:11 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: In-Reply-To: <3F8B00F6.1050206@comcast.net>; from "Robert I. Eachus" at Mon, 13 Oct 2003 19:46:41 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:843 Date: 2003-10-14T21:11:39+04:00 Robert I. Eachus wrote: > > Implicit conversions for literals is the most important case, both practically > > and ideologically. So, if the choice is between "implicit conversions for > > literals only" and "no implicit conversions at all, as it is now" then I > > definitely choose first option. > > Go ahead and advocate it, I suppose you mean proposing that in Ada-Comment, right? (I don't know any other place for that, as the comp.lang.ada stage is already passed.) > The tricky > part would be proposing the language notation for binding a set of > literals to a private type. Thank you for this hint (I really needed it, and the word "binding" there appeared somehow important for me). How do you think about straightforward solution (for that language notation), which relies upon new attribute, say, Literal_Conversion? I mean that in Ada.Strings.Unbounded package we can include: 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). Then, there is a problem, for which I need an advice: should this new feature (implicit conversion of literals to private types) be restricted to the types defined in the language standard and types added by an implementation? Or it should be made available to all user-defined types without any restrictions? I tend to think there should be some restrictions, but right now I have neither good criteria for that nor appropriate mechanism for enforcement. Also, I am in doubt about overriding Literal_Conversion for derived types - whether this opportunity desirable or not... and how that overriding (for attributes) may be controlled (the attributes is so mystical thing, I never saw any general explanation of the nature of and rules for attributes - neither in ARM nor in Barnes's book nor in Cohen's book). Alexander Kopilovitch aek@vib.usr.pu.ru Saint-Petersburg Russia