Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inheritance fails with qualified name #137

Closed
skaller opened this issue Mar 5, 2019 · 2 comments
Closed

Inheritance fails with qualified name #137

skaller opened this issue Mar 5, 2019 · 2 comments
Assignees

Comments

@skaller
Copy link
Member

skaller commented Mar 5, 2019

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.

@skaller skaller self-assigned this Mar 5, 2019
@skaller
Copy link
Member Author

skaller commented Mar 10, 2019

Hmm .. maybe this is actually RIGHT.

@skaller
Copy link
Member Author

skaller commented Mar 9, 2020

It's correct. Not a bug.

@skaller skaller closed this as completed Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant