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-Language: ENGLISH,ASCII X-Google-Thread: 103376,43aafc250d42730f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-08 13:09:44 PST Path: supernews.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.stanford.edu!newsfeed.mesh.ad.jp!sjc-peer.news.verio.net!news.verio.net!sjc-read.news.verio.net.POSTED!not-for-mail Newsgroups: comp.lang.ada From: Brian Rogoff Subject: Re: controlled type in generic package? In-Reply-To: <95sgl2$3c8$1@wanadoo.fr> Message-ID: References: <3A7FDA9A.C667090F@stn-atlas.de> <95p2ab$463$1@nnrp1.deja.com> <95sgl2$3c8$1@wanadoo.fr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN Content-Transfer-Encoding: QUOTED-PRINTABLE Date: Thu, 08 Feb 2001 21:10:07 GMT NNTP-Posting-Host: 206.184.139.136 X-Complaints-To: abuse@verio.net X-Trace: sjc-read.news.verio.net 981666607 206.184.139.136 (Thu, 08 Feb 2001 21:10:07 GMT) NNTP-Posting-Date: Thu, 08 Feb 2001 21:10:07 GMT Organization: Verio Xref: supernews.google.com comp.lang.ada:5027 Date: 2001-02-08T21:10:07+00:00 List-Id: On Wed, 7 Feb 2001, Jean-Pierre Rosen wrote: > "Ted Dennison" a =E9crit dans le message news: 95= p2ab$463$1@nnrp1.deja.com... > > Also, any instantiations of this generic will have to be done at the > > library level, since Limited_Controlled is declared at the library > > level, and types can't be declared at a lower level of scope than their > > parent types. (As a user, I hate that rule.) > > > I have sympathy for this feeling, and I see many people falling into that= trap, but to be fair: > Do you know ANY language that allows it ? Yes (*). But the real issue in my mind is not so much the issue of nested derivations as the fact that Controlled is a special kind of tagged type.= =20 I'm not saying that there is a better solution, just that from the user point of view it's a real PITA.=20 It's also the case that "controlledness" is infectious in the same way as= =20 "limitedness" which allows getting around single inheritance issues for=20 controlledness but is still inelegant in my view.=20 >=20 > Most OO languages (C++, Java, Eiffel, even Turbo-Pascal) do not allow dec= laring classes within a subprogram. > In Ada, all classes must be declared at the same level. In other language= s, all classes must be declared at level 0. > So Ada is actually *more* permissive than other languages... Yes, C++, Java and Eiffel are fairly "flat" languages, like Python and unlike Ada. Anyone remember what CLOS does?=20 -- Brian (*) Why, OCaml of course! Not that I'd ever likely write code like this... class point x_init =3D object (self) val mutable x =3D x_init method get_x =3D x method private move d =3D x <- x + d method bump =3D self#move 1 end let f x =3D=20 let module M =3D (* nested module necessary for nested class decl *) struct class colored_point x (c : string) =3D =09object=20 =09 inherit point x =09 val c =3D c =09 method color =3D c =09end let cp =3D new colored_point x "blue" let foo =3D cp#get_x end in=20 print_endline ("val =3D " ^ (string_of_int M.foo))