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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news-xfer.newsread.com!nntp.abs.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Tue, 31 Aug 2004 08:42:49 -0400 From: Hyman Rosen User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request References: <49dc98cf.0408110556.18ae7df@posting.google.com> <1198227.gWQ0keDDOY@linux1.krischik.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1093956169.632925@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1093956169 2998 204.253.250.10 Xref: g2news1.google.com comp.lang.ada:3208 Date: 2004-08-31T08:42:49-04:00 List-Id: Jean-Pierre Rosen wrote: > However, all other OO languages (that I know of) require > *all* classes to be declared at library level. Certainly neither C++ nor Java require this. I will occasionally write the following C++ code, when I'm too lazy to do the right thing and make a more widely reusable class. void some_func() { extern int some_global_a, some_global_b; struct restorer { int &sg, oldval; restorer(int &var, int newval) : sg(var), oldval(var) { } ~restorer() { sg = oldval; } }; restorer rsga(some_global_a, 53); restorer rsgb(some_global_b, -1); // ... } Java allows you to write "inner classes", even anonymous ones, at pretty much any point in your code. They are often used to create tiny class objects which implement an interface, as callbacks for example. Something like this button.setClickCB(new INotify { void notify() { /* stuff */ } });