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,2e6723b897ab47fb X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.74.6 with SMTP id p6mr1965641pav.5.1344354751830; Tue, 07 Aug 2012 08:52:31 -0700 (PDT) Path: g9ni6072412pbo.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Ada.Locales pseudo-string types Date: Tue, 7 Aug 2012 08:46:09 -0700 (PDT) Organization: http://groups.google.com Message-ID: <2cca3f0c-b58c-4e39-85ce-4a150c306f61@googlegroups.com> References: <78707b6e-88a3-453a-a37c-840f7a62e703@googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1344354745 7416 127.0.0.1 (7 Aug 2012 15:52:25 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 7 Aug 2012 15:52:25 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-08-07T08:46:09-07:00 List-Id: On Monday, August 6, 2012 10:57:33 PM UTC-7, Jeffrey R. Carter wrote: > This works: > > with Ada.Text_IO; > with Ada.Unchecked_Conversion; > > procedure Weird_Output is > type Weird is array (Positive range 1 .. 3) of Character range 'A' .. 'Z'; > > subtype Weird_Image is String (1 .. 3); > > function Image is new Ada.Unchecked_Conversion (Source => Weird, Target => Weird_Image); > > C : constant Weird := "ABC"; > begin -- Weird_Output > Ada.Text_IO.Put_Line (Item => Image (C) ); > end Weird_Output; Blecch. Using Unchecked_Conversion seems like a good solution--if it's buried in the implementation of a To_String function in the body of Ada.Locales as I proposed. Making users use it is just icky. -- Adam