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-14 13:26:17 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.mathworks.com!wn13feed!wn11feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc04.POSTED!not-for-mail From: "Mark A. Biggar" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: U : Unbounded_String := "bla bla bla"; (was: Is the Writing...) References: <3F8B00F6.1050206@comcast.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.235.88.213 X-Complaints-To: abuse@comcast.net X-Trace: sccrnsc04 1066163176 12.235.88.213 (Tue, 14 Oct 2003 20:26:16 GMT) NNTP-Posting-Date: Tue, 14 Oct 2003 20:26:16 GMT Organization: Comcast Online Date: Tue, 14 Oct 2003 20:26:16 GMT Xref: archiver1.google.com comp.lang.ada:855 Date: 2003-10-14T20:26:16+00:00 List-Id: Alexandre E. Kopilovitch wrote: > 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). 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. -- mark@biggar.org mark.a.biggar@comcast.net