In article , "Jean-Pierre Rosen" wrote: > > a �crit dans le message news: 95tpba$9va$1@nnrp1.deja.com... > >[...] > > > procedure P is > > > type Child is new Parent with...; > > > procedure Proc (X : Child) is... end Proc; > > > begin > > > V := new Child; > > > end P; > > > > > > > This is an issue of how dispatch tables are implemented and > > maintained > > at run-time. One could imagine a mechanism that would restore the > > dispatch table, when a derived type goes away. The type tag could > > be "redirected" to the base type tag, or the table slots > > corresponding to the overriden methods could be restored etc. What > > is really nasty, is that the semantic of V.Proc would depend on the > > context. > > > No, you miss the point. A (dispatching) call to P.Proc could access > P's local variables, but such variables would not exist at the > time P.Proc is called. No dispatch to P.Proc happens, if the dispatch table is corrected after leaving P.Proc declaration scope (i.e. upon return from P). The correction might be replacing address of P.Proc by address Pack.Proc. Then V.Proc is dispatched to Pack.Proc. Such approach has several drawbacks (starting from the necessity to have dispatch dynamic tables). But I see no better way to allow local overrides. Another nasty thing with unlimited local overrides is that virtually no expression involving methods will be static. If we write (this is not Ada): package MyNumbers is type MyNumber is tagged ... function "not" (X : MyNumber) return MyNumber; ... end MyNumbers; Then procedure Foo is X : constant MyNumber := 1; -- Static Y : constant MyNumber := not X; -- Not static! begin ... end Foo; No matter the Y type tag is statically known, it cannot be static, because "not" could be overriden at the call point of Foo! -- Regards, Dmitry Kazakov Sent via Deja.com http://www.deja.com/