comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Array slices and types
Date: Wed, 20 Aug 2008 13:45:39 -0700 (PDT)
Date: 2008-08-20T13:45:39-07:00	[thread overview]
Message-ID: <1eb141ff-82f8-4969-a525-5e931419d631@1g2000pre.googlegroups.com> (raw)
In-Reply-To: 5886ab95-8744-4b72-b911-e4cb8889c7e7@d1g2000hsg.googlegroups.com

On Aug 20, 7:51 am, Maciej Sobczak <see.my.homep...@gmail.com> 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.

Do you really need a new *type*, as opposed to:

   subtype Name is String (1 .. 10);

???

(The answer may be yes.  But I would not declare Name to be a new
*type*, rather than a subtype, unless there's a reason for this---such
as Name being declared earlier as a private type.  I just wanted to
make sure that you were aware that declaring a subtype is a
possibility.)

                                 -- Adam





  parent reply	other threads:[~2008-08-20 20:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20 14:51 Array slices and types Maciej Sobczak
2008-08-20 15:26 ` Niklas Holsti
2008-08-20 15:46 ` Dmitry A. Kazakov
2008-08-20 18:52   ` Niklas Holsti
2008-08-20 20:01     ` Simon Wright
2008-08-21  5:26       ` Niklas Holsti
2008-08-21  8:53         ` Dmitry A. Kazakov
2008-08-21 14:44           ` Adam Beneschan
2008-08-21 15:46             ` Dmitry A. Kazakov
2008-08-22  4:30             ` Randy Brukardt
2008-08-20 17:47 ` stefan-lucks
2008-08-20 17:51   ` stefan-lucks
2008-08-20 20:45 ` Adam Beneschan [this message]
2008-08-21 21:16   ` Maciej Sobczak
2008-08-23  2:50 ` Steve
replies disabled

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