comp.lang.ada
 help / color / mirror / Atom feed
From: Nick Roberts <nick.roberts@acm.org>
Subject: Re: Converting access values
Date: Fri, 7 Jan 2005 20:23:00 +0000
Date: 2005-01-07T20:23:00+00:00	[thread overview]
Message-ID: <gemini.i9yrab00bd9ue02as.nick.roberts@acm.org> (raw)
In-Reply-To: m31xcxdnoz.fsf@0x53586c58.boanxx18.adsl-dhcp.tele.dk

Mark Lorenzen <mark.lorenzen@ofir.dk> wrote:

> As I said in another posting, I am going for a design like this:
> 
> type Buffer_Slice is
>    record
>      Data  : Buffer_Ptr;
>      First : Ada.Streams.Stream_element_Offset;
>      Last  : Ada.Streams.Stream_element_Offset;
>    end record;
> ...
> It solves the problem, but exposes a bit more information to the clients
> than necessary. It is very easy for a client to address a slice outside
> the bounds:
> ...

Since you put it that way, I see your point. I suppose it is an area where
Ada fails to provide a level of abstraction that perhaps it should. It's
almost as if we want a new kind of access type, the 'slice access' type,
that can point to a slice of an array, e.g.:

   type Buffer_Slice is access range Stream_Element_Array;

objects of which, when dereferenced, can be used anywhere a
Stream_Element_Array object can, and have the same attributes (First and
Last and so on).

-- 
Nick Roberts



  reply	other threads:[~2005-01-07 20:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-05 22:31 Converting access values Mark Lorenzen
2005-01-05 23:32 ` Stephen Leake
2005-01-05 23:51   ` Mark Lorenzen
2005-01-06  0:18 ` Jeffrey Carter
2005-01-06  0:28   ` Mark Lorenzen
2005-01-07 16:55     ` Nick Roberts
2005-01-07 19:49       ` Mark Lorenzen
2005-01-07 20:23         ` Nick Roberts [this message]
2005-01-07 21:23           ` Robert A Duff
2005-01-11 17:02             ` Upkeep
2005-01-11 21:37               ` Robert A Duff
2005-01-12  4:56                 ` Alexander E. Kopilovich
2005-01-12 10:48                 ` Dmitry A. Kazakov
2005-01-07 21:17         ` Randy Brukardt
2005-01-07 22:15           ` Robert A Duff
2005-01-06 10:52 ` Dmitry A. Kazakov
2005-01-06 11:02 ` Duncan Sands
2005-01-06 12:17   ` Martin Dowie
2005-01-06 19:30   ` Mark Lorenzen
2005-01-06 20:40     ` Randy Brukardt
replies disabled

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