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-Thread: 103376,640b65cbfbab7216 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news2.google.com!news.glorb.com!proxad.net!feeder1-2.proxad.net!193.252.118.146.MISMATCH!news.wanadoo.fr!news.wanadoo.fr!not-for-mail Message-ID: <47F749CB.30806@obry.net> Date: Sat, 05 Apr 2008 11:43:39 +0200 From: Pascal Obry Organization: Home - http://www.obry.net User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 Newsgroups: comp.lang.ada To: Gautier Subject: Re: Ada.Strings.Bounded References: <47F26C46.3010607@obry.net> <44d88b93-6a90-4c18-8785-2164934ba700@a9g2000prl.googlegroups.com> <47F652F7.9050502@obry.net> <47f7028d$1_6@news.bluewin.ch> In-Reply-To: <47f7028d$1_6@news.bluewin.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Date: 05 Apr 2008 11:43:38 CEST NNTP-Posting-Host: 82.124.251.208 X-Trace: 1207388618 news.orange.fr 860 82.124.251.208:4101 X-Complaints-To: abuse@orange.fr Xref: g2news1.google.com comp.lang.ada:20834 Date: 2008-04-05T11:43:38+02:00 List-Id: Gautier, > Do you mean something like that ? No quite as: B1 : BorString (10); B2 : BorString (20); B1 := B2; -- will raises constraint error With Unbounded_String we are close to something "usable". U1 : Unbounded_String; U2 : Unbounded_String; U1 := U2; Works fine! But then it becomes a bit messy when converting back and forth with the string type. U1 := To_Unbounded_String ("whatever"); Put_Line (To_String (U1)); Not a big deal, but if we can find a nice way to tell that such routine must be used for conversion between type it will be quite handy. type Unbounded_String is ...; function To_String (U : Unbounded_String) return String; for Unbounded_String'Conversion (String) use To_String; Just to get the idea, then one could write: Put_Line (U1); Of course this raises some questions: What to do if we have Put_Line defined for String and Unbounded_String? Which version gets called? ... Anyway that's just some wild thoughts :) Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.net --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595