On Wed, 7 Feb 2001, Jean-Pierre Rosen wrote: > "Ted Dennison" a écrit dans le message news: 95p2ab$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. I'm not saying that there is a better solution, just that from the user point of view it's a real PITA. It's also the case that "controlledness" is infectious in the same way as "limitedness" which allows getting around single inheritance issues for controlledness but is still inelegant in my view. > > Most OO languages (C++, Java, Eiffel, even Turbo-Pascal) do not allow declaring classes within a subprogram. > In Ada, all classes must be declared at the same level. In other languages, 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? -- Brian (*) Why, OCaml of course! Not that I'd ever likely write code like this... class point x_init = object (self) val mutable x = x_init method get_x = x method private move d = x <- x + d method bump = self#move 1 end let f x = let module M = (* nested module necessary for nested class decl *) struct class colored_point x (c : string) = object inherit point x val c = c method color = c end let cp = new colored_point x "blue" let foo = cp#get_x end in print_endline ("val = " ^ (string_of_int M.foo))