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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2a3157e5254b8223 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!eweka.nl!lightspeed.eweka.nl!195.114.231.69.MISMATCH!feeder.news-service.com!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Array slices and types Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <5886ab95-8744-4b72-b911-e4cb8889c7e7@d1g2000hsg.googlegroups.com> Date: Wed, 20 Aug 2008 17:46:32 +0200 Message-ID: <1k5uib98w8fgw.bno6vggps1p3.dlg@40tude.net> NNTP-Posting-Date: 20 Aug 2008 17:46:34 CEST NNTP-Posting-Host: 608447ff.newsspool4.arcor-online.net X-Trace: DXC=TI_:jd`?WkQf8j24CD<3lP4IUK\BH3YRW[I=;[6A8WYDNcfSJ;bb[UIRnRBaCd On Wed, 20 Aug 2008 07:51:02 -0700 (PDT), Maciej Sobczak wrote: > Consider this: > > type Name is new String (1 .. 10); > > N : Name; > > Some_String : String := "abc"; > > How can I assign Some_String to the beginning slice (ie. to the first > three characters) of N? > Everything that I can think of (short of copying characters > individually) hits the type compatibility problem. You need an unconstrained base type for this. In your case the base is anonymous. So name it: type Name_Base is new String; -- The base type is now named subtype Name is Name_Base (1..10); N : Name; Some_String : String := "abc"; begin N (1..3) := Name_Base (Some_String); -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de