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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,21960280f1d61e84 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!homer!news.glorb.com!news-spur1.glorb.com!news.glorb.com!proxad.net!proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail Newsgroups: comp.lang.ada Subject: Re: GC in Ada From: Georg Bauhaus In-Reply-To: References: <1169636785.504223.139630@j27g2000cwj.googlegroups.com> <3pejpgfbki.fsf@hod.lan.m-e-leypold.de> <45c99c24$1@news.post.ch> <45c9bdb8$1@news.post.ch> <45cad095$1@news.post.ch> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: # Message-Id: <1171028868.5352.18.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Date: Fri, 09 Feb 2007 14:47:48 +0100 NNTP-Posting-Date: 09 Feb 2007 14:47:30 CET NNTP-Posting-Host: 89b48f50.newsspool4.arcor-online.net X-Trace: DXC=4:nDCF[@_<_U6b:FjPaGjQ4IUK On Thu, 2007-02-08 at 10:33 +0100, Markus E Leypold wrote: > > Martin Krischik writes: > > Only Java has no const keyword. It is supposed to get one but how long > > until it is actually used? > > > Excuse me, but ... "a read only interface" means: > > (a) make all field of objects private > (b) allow access only my methods What Eiffel does by design. > (c) provide only Get_*-methods, no Set_*-methods This lets programmers design type interfaces and wrappers so that objects are effectively read-only. Wouldn't it be nice to just export a constant view where needed? Like C++'s const& or Ada's access-to-constant? Or to have C++ const view and Ada in mode parameters that extend to the referred object? procedure a is type J is record x: Integer; end record; procedure nope(this: in J; new_x: Integer) is begin this.x := new_x; -- compile time error end nope; begin nope(42); end a; struct J { int x; }; int main() { J wj; const J rj = wj; wj.x = 42; rj.x = 42; // compile time error return 0; }