You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class X[T] {
virtual fun f: T -> string;
fun g(x:T) => "g" + x.str + "g";
}
instance X[int] {
fun f(x:int)=> "X."+x.str+".X";
}
class Y[T] {
inherit X[T];
}
instance Y[int] {
fun f(x:int)=> "Y."+x.str+".Y";
}
println$ X::f 42;
println$ X::g 42;
open Y[int];
println$ f 42; // works
// println$ Y[int]::f 42; // fails
With the open of Y[int] the working like prints the instance from X.
This is correct I think. The algebra classes in the library depend on this,
it is documented.
However the commented out line should work. All the methods of X should be
in the public lookup table for Y "as if they had been defined there". Indeed they
must be or the open Y[int] directive would not work.
The text was updated successfully, but these errors were encountered:
With the open of Y[int] the working like prints the instance from X.
This is correct I think. The algebra classes in the library depend on this,
it is documented.
However the commented out line should work. All the methods of X should be
in the public lookup table for Y "as if they had been defined there". Indeed they
must be or the open Y[int] directive would not work.
The text was updated successfully, but these errors were encountered: