comp.lang.ada
 help / color / mirror / Atom feed
From: brbarkstrom@gmail.com
Subject: Re: Textedit and txt
Date: Sat, 9 May 2015 08:23:39 -0700 (PDT)
Date: 2015-05-09T08:23:39-07:00	[thread overview]
Message-ID: <13a13e0e-0de4-4235-9e1e-c6e0446d3f04@googlegroups.com> (raw)
In-Reply-To: <35aabdcd-6064-4999-9cdf-d143b0593a31@googlegroups.com>

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.


  parent reply	other threads:[~2015-05-09 15:23 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 21:40 Annoying behavior Laurent
2015-04-25  4:31 ` gautier_niouzes
2015-04-25  6:51   ` Laurent
2015-04-25  4:50 ` Niklas Holsti
2015-04-25  7:15   ` Laurent
2015-04-25  8:10     ` Niklas Holsti
2015-04-25 15:37       ` Laurent
2015-04-25 13:54 ` Stephen Leake
2015-04-25 15:46   ` Laurent
2015-04-25 17:02     ` Simon Wright
2015-04-25 17:41     ` Niklas Holsti
2015-04-25 18:58       ` Laurent
2015-04-25 19:30         ` Georg Bauhaus
2015-04-25 20:13           ` Laurent
2015-04-25 21:46             ` Laurent
2015-04-25 23:16           ` Bob Duff
2015-04-26 10:38     ` Jedi Tek'Unum
2015-04-26 11:52       ` Textedit and txt Laurent
2015-04-26 13:21         ` brbarkstrom
2015-05-06 21:23           ` Randy Brukardt
2015-05-07 21:12             ` Laurent
2015-05-07 21:48               ` Simon Wright
2015-05-07 22:24                 ` Laurent
2015-05-08  5:50                   ` Simon Wright
2015-05-08  7:35                     ` Laurent
2015-05-08 23:35               ` Randy Brukardt
2015-05-09 19:25                 ` Laurent
2015-05-09 21:36                   ` Anh Vo
2015-05-11 17:00                 ` Shark8
2015-05-11 17:49                   ` Dmitry A. Kazakov
2015-05-09 15:23               ` brbarkstrom [this message]
2015-05-12  1:10                 ` Randy Brukardt
2015-05-12 12:44                   ` brbarkstrom
2015-05-12 21:57                     ` Randy Brukardt
2015-05-13 12:07                       ` brbarkstrom
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox