comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: "out" or "access"
Date: 1998/11/01
Date: 1998-11-01T00:00:00+00:00	[thread overview]
Message-ID: <wccsog4p3y1.fsf@world.std.com> (raw)
In-Reply-To: m3ww5hrbmr.fsf@mheaney.ni.net

Matthew Heaney <matthew_heaney@acm.org> writes:

> You are correct.  However, the library I'm building has one iterator
> type, that can be used to both query and modify objects in the
> collection.  The representation of the iterator must therefore include
> an access-to-variable access type.

Perhaps you should have two different sorts of iterators, one that can
modify, and one that can't.

> So perhaps I'm going beyond what even access constant params buy you.
> Maybe my real problem is how to "cast away const."

Sounds dangerous.

>...  It would be hip if
> the language provided a way to do that explicitly, analogous to
> something like Unchecked_Conversion.
> 
> BTW: does the language define --or give implementation advice-- on what
> the effect of unchecked conversion from access-to-constant to
> access-to-variable is?  Or is it the intention of the designers that you
> never try to do that?

I think you should not do that.  What should it mean?  I mean, if you
modify a constant?  An Ada compiler is within it's rights to put
constant stuff in read-only memory -- and if you modify it, you get a
core dump or some such nasty thing.  Or share memory for the same
constant data -- you better not change it.

Perhaps you should give an example.  It seems like cast-away-const is
even worse than any type-cheating one might want to do.

> Oh yes, but this doesn't meet my needs, because you need to call a
> dispatching operation ("factory method") that returns an iterator of a
> class-wide type.  Class-wide types are indefinate, and therefore require
> initialization during object declaration, which isn't possible if the
> type is limited.

I wish we could initialize limited things, but still not copy them
around.  Sigh.

- Bob
-- 
Change robert to bob to get my real email address.  Sorry.




  reply	other threads:[~1998-11-01  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-21  0:00 "out" or "access" =:-) Vincent
1998-10-21  0:00 ` dennison
1998-10-21  0:00 ` Tucker Taft
1998-10-22  0:00   ` Pascal Obry
1998-10-29  0:00     ` Robert A Duff
1998-10-29  0:00       ` Matthew Heaney
1998-10-29  0:00         ` Robert A Duff
1998-10-30  0:00           ` dennison
1998-10-30  0:00             ` Matthew Heaney
1998-10-30  0:00               ` Robert A Duff
1998-10-31  0:00                 ` Matthew Heaney
1998-11-01  0:00                   ` Robert A Duff [this message]
1998-11-01  0:00                     ` Matthew Heaney
1998-11-01  0:00                       ` Robert A Duff
1998-11-02  0:00                         ` Matthew Heaney
1998-11-03  0:00                           ` Simon Wright
1998-11-16  0:00                             ` Matthew Heaney
1998-10-31  0:00                 ` dewar
1998-10-31  0:00                   ` Matthew Heaney
1998-10-21  0:00 ` Jeff Carter
1998-10-21  0:00   ` Pat Rogers
1998-10-21  0:00     ` Martin C. Carlisle
1998-10-22  0:00       ` Pat Rogers
1998-10-22  0:00     ` Robert A Duff
replies disabled

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