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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9a7e0c43216f4def X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: "out" or "access" Date: 1998/11/01 Message-ID: #1/1 X-Deja-AN: 407143128 Sender: bobduff@world.std.com (Robert A Duff) References: <908956499.754394@dedale.pandemonium.fr> <70mo3h$gll$1@cf01.edf.fr> <71cjab$ka8$1@nnrp1.dejanews.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1998-11-01T00:00:00+00:00 List-Id: Matthew Heaney 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.