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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.26.240 with SMTP id c76mr5237729yha.8.1431185020063; Sat, 09 May 2015 08:23:40 -0700 (PDT) X-Received: by 10.140.83.165 with SMTP id j34mr35152qgd.23.1431185020024; Sat, 09 May 2015 08:23:40 -0700 (PDT) Path: border1.nntp.dca1.giganews.com!nntp.giganews.com!z60no6288435qgd.0!news-out.google.com!t92ni257qga.1!nntp.google.com!z60no6288430qgd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 9 May 2015 08:23:39 -0700 (PDT) In-Reply-To: <35aabdcd-6064-4999-9cdf-d143b0593a31@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=50.111.106.222; posting-account=Ies7ywoAAACcdHZMiIRy0M84lcJvfxwg NNTP-Posting-Host: 50.111.106.222 References: <47c7df1e-17c1-44cb-a455-43431f0d39cd@googlegroups.com> <85zj5wb9et.fsf@stephe-leake.org> <4b14659e-8c26-4c0a-8945-a5289740e054@googlegroups.com> <51c639dd-a48c-4130-becd-750cb23094da@googlegroups.com> <35aabdcd-6064-4999-9cdf-d143b0593a31@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <13a13e0e-0de4-4235-9e1e-c6e0446d3f04@googlegroups.com> Subject: Re: Textedit and txt From: brbarkstrom@gmail.com Injection-Date: Sat, 09 May 2015 15:23:40 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: number.nntp.giganews.com comp.lang.ada:193096 Date: 2015-05-09T08:23:39-07:00 List-Id: On Thursday, May 7, 2015 at 5:12:29 PM UTC-4, Laurent wrote: > On Wednesday, May 6, 2015 at 11:23:36 PM UTC+2, Randy Brukardt wrote: > > Hi > > I tried to put that package together but I get this error on the second function: > > 14:4 no visible subprogram matches the specification for "+" > 14:4 missing specification for "Drop" > > > with Ada.Strings.Bounded; > > package Common_Defs is > > V_String_Length : constant := 256; > > package V_String is new > Ada.Strings.Bounded.Generic_Bounded_Length (V_String_Length); > > function "+" (Right : V_String.Bounded_String) return String > renames > V_String.To_String; > > function "+" (Right : String) return V_String.Bounded_String > ^----- error > renames > V_String.To_Bounded_String; > > end Common_Defs; > > I have no idea what the compiler is complaining about. > > > Note that some people hate using "+" this way, because they think it has > > something to do with numerics. We really should have something non-specific > > (say an operator "#"), but the ARG is always split between people that think > > we already have such an operator ("+") and thus we don't need another one > > and those that are repulsed by using "+" this way. (Getting these put into > > the packages themselves failed for similar reasons. Grumble.) > > Well if it makes life easier why not use it. And if someone does't like to use a '+' then take something else, as long as you remember what it is doing. > > >I'd prefer a completely different design for both of these packages, so we could add some >mechanism to allow direct conversions, but that's likely too radical.) > > Why would that be too radical? > > Thanks > > Laurent Sorry to go back in the thread. However, instead of creating a new symbol '+' to indicate append, it might be easier to consult the Ada RM. In section A.4.4 of the Ada 2012 RM, there are a number of overloaded functions specifically called 'Append'. Furthermore, the second page of this section specifically uses '&' as an append operator. Since these two constructions are already part of the package `Bounded_String', it isn't clear what we gain by using a variant construction. Bruce B.