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.107.169.78 with SMTP id s75mr8519865ioe.31.1447252322470; Wed, 11 Nov 2015 06:32:02 -0800 (PST) X-Received: by 10.182.227.200 with SMTP id sc8mr101690obc.10.1447252322337; Wed, 11 Nov 2015 06:32:02 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!i2no1849199igv.0!news-out.google.com!f6ni1116igq.0!nntp.google.com!i2no323146igv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 11 Nov 2015 06:32:02 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=50.111.88.142; posting-account=Ies7ywoAAACcdHZMiIRy0M84lcJvfxwg NNTP-Posting-Host: 50.111.88.142 References: <7ba56b33-28d4-42d2-8b9b-5ad9f5beab8b@googlegroups.com> <87io597447.fsf@theworld.com> <66278720-249a-4191-a908-bb840e7f3ccc@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Bounded String question From: brbarkstrom@gmail.com Injection-Date: Wed, 11 Nov 2015 14:32:02 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:28299 Date: 2015-11-11T06:32:02-08:00 List-Id: > >I've had to write loads of functions like "To_Client_Name (Name : in String) >return T_Client_Name is (T_Client_Name (P_Strings.To_Bounded_String (Name));" > > What does escape my understanding is why can I use To_String with any type defined from P_Strings but have to define all the To_xyz explicitly. Is there a kind of "hidden" conversion applied in that case? > > >I've been considering using unbounded strings instead but then I'm dropping >the idea of a bounded storage for my entities. Most of these "strings" ends >up in record types which in the end will map to database entities. > > I still have the same issue with Bounded Strings anyway. So no point. Probably the sensible approach is not to expect Ada to act like C. I use Bounded_Strings constantly and just expect to do the conversion from Bounded_Strings to plain String (and back). It's a bit more verbose, but that may just be one of the costs of strong typing. I'd also note that P_String seems to be rather close to the type name one would use in C for a pointer (or an access type in Ada). Personally, I'd find that confusing. Bruce B.