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,c406e0c4a6eb74ed X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!proxad.net!freenix!oleane.net!oleane!skymaster!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: ADA Popularity Discussion Request Date: Tue, 31 Aug 2004 19:29:42 +0200 Organization: Adalog Message-ID: <4ic2hc.1q.ln@skymaster> References: <49dc98cf.0408110556.18ae7df@posting.google.com> <1198227.gWQ0keDDOY@linux1.krischik.com> <1093956169.632925@master.nyc.kbcfp.com> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: s5.feed.news.oleane.net 1093975339 17331 195.25.228.57 (31 Aug 2004 18:02:19 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Tue, 31 Aug 2004 18:02:19 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; fr-FR; rv:1.7.2) Gecko/20040803 X-Accept-Language: fr-fr, en-us, en In-Reply-To: <1093956169.632925@master.nyc.kbcfp.com> Xref: g2news1.google.com comp.lang.ada:3221 Date: 2004-08-31T19:29:42+02:00 List-Id: Hyman Rosen a =E9crit : > Jean-Pierre Rosen wrote: > > However, all other OO languages (that I know of) require >=20 >> *all* classes to be declared at library level. >=20 >=20 > 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. >=20 > 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 =3D oldval; } > }; > restorer rsga(some_global_a, 53); > restorer rsgb(some_global_b, -1); > // ... > } >=20 If I'm not mistaken, last time I looked at C++ such inner types had=20 local visibility, but still global scope. Not the same thing as truly=20 "local" classes. Correct me if I'm wrong. > 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 */ } }); Inner classes are classes within classes (same as package inside=20 package, which Ada of course allows), not classes inside functions. --=20 --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr