From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: ADA.STRINGS.INDEX_ERROR : a-strunb.adb:782
Date: Thu, 18 Jan 2018 09:34:48 +0100
Date: 2018-01-18T09:34:48+01:00 [thread overview]
Message-ID: <p3pm77$1jvi$1@gioia.aioe.org> (raw)
In-Reply-To: 6e4679ff-6058-40ec-821a-791507313906@googlegroups.com
On 17/01/2018 23:50, Mehdi Saada wrote:
>> Remember position vs. index:
>> Length : constant Integer := Object'Length;
>> First : constant Index_Type := Object'First;
>> Last : constant Index_Type := Object'Last;
>
> Yeah, an Integer subtype. Ah, always something I forget to precise explicitely.
> I saw it goes along well with a constant declaration, but I wanted a renaming declaration...
You can rename result of a function too. (It does make much sense in the
case of scalar values returned by value).
However you cannot rename a non-object. A subtle distinction, but it is
there. That would prevent renaming of an attribute Object'Length which
is not an object for whatever strange reason. Attributes have a long
history of being queer. E.g. "abc"'Length is still illegal, AFAIK. In
Ada attributes are not considered operations as they should.
A discriminant of some object can be renamed, no problem. So
type Object_Type (Length : Natural) is ...;
Object : Object_Type (10);
Length : Integer renames Object.Length; -- This is OK, 10
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2018-01-18 8:34 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-15 1:18 ADA.STRINGS.INDEX_ERROR : a-strunb.adb:782 Mehdi Saada
2018-01-15 3:23 ` Niklas Holsti
2018-01-15 8:29 ` Dmitry A. Kazakov
2018-01-15 10:49 ` Simon Wright
2018-01-15 11:51 ` Mehdi Saada
2018-01-15 12:00 ` Mehdi Saada
2018-01-15 13:32 ` Dmitry A. Kazakov
2018-01-15 18:55 ` Shark8
2018-01-15 13:51 ` Simon Wright
2018-01-15 15:18 ` Mehdi Saada
2018-01-15 15:29 ` Mehdi Saada
2018-01-15 15:50 ` Mehdi Saada
2018-01-15 17:53 ` Simon Wright
2018-01-15 17:22 ` Anh Vo
2018-01-15 17:48 ` Dmitry A. Kazakov
2018-01-15 19:56 ` Anh Vo
2018-01-16 16:06 ` Brian Drummond
2018-01-16 17:21 ` Anh Vo
2018-01-15 10:37 ` Simon Wright
2018-01-15 16:06 ` Mehdi Saada
2018-01-17 19:23 ` Niklas Holsti
2018-01-16 16:24 ` Mehdi Saada
2018-01-16 18:20 ` Jacob Sparre Andersen
2018-01-16 20:00 ` Mehdi Saada
2018-01-17 15:45 ` Mehdi Saada
2018-01-17 16:30 ` Dmitry A. Kazakov
2018-01-17 22:50 ` Mehdi Saada
2018-01-18 8:34 ` Dmitry A. Kazakov [this message]
2018-01-18 11:14 ` Simon Wright
2018-01-18 11:55 ` Dmitry A. Kazakov
2018-01-18 12:21 ` Mehdi Saada
2018-01-18 13:08 ` J-P. Rosen
2018-01-18 15:23 ` Dmitry A. Kazakov
2018-01-19 1:10 ` Randy Brukardt
2018-01-19 8:52 ` Dmitry A. Kazakov
2018-01-20 0:42 ` Randy Brukardt
2018-01-20 9:47 ` Dmitry A. Kazakov
2018-01-23 0:44 ` Randy Brukardt
2018-01-18 14:05 ` AdaMagica
2018-01-18 14:17 ` Mehdi Saada
2018-01-18 14:56 ` J-P. Rosen
2018-01-18 15:38 ` Mehdi Saada
2018-01-19 1:13 ` Randy Brukardt
2018-01-18 16:48 ` AdaMagica
2018-01-18 16:59 ` Dmitry A. Kazakov
2018-01-18 19:36 ` Mehdi Saada
2018-01-19 1:21 ` Randy Brukardt
2018-01-19 16:15 ` AdaMagica
2018-01-19 16:58 ` Dmitry A. Kazakov
2018-01-21 23:27 ` G.B.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox