Referring to the type of an inner class in Scala -
tries to duplicate the following code: Instead of behaving in Inner
, it is encoded I've added the useInner
method I insert
method of its enclosed class so that the user should refer only to the Inner
examples, but always have a brief example of By doing so, all the Inner
examples from a specific external
example are only one Are bound to behave (but here it needs).
Boolean (X: External #Inner): Boolean = X. Encoding.INTERNATOR (x)
/ Code> / Pre>It does not compile and Scala 2.8 complains:
type mismatch; Found: sandbox External # Internal Required: _81.Inner where Wal _81: Sandbox. From the external
I think the problem is that an
Inner
example fromuseInner
specificexternal
example As arguments as expected.What is the true explanation and how to solve this problem?
I think the type of infer is like this. Inner External # Internal is not independent of external examples (depending on a path-dependent type).
Abstract class exterior {sealing word inner {df enclosing = outter.e} def useiner (ex: external # inner): boolean} def toBoolean (x: external #internal): boolean = x .enclosing.useInner (x)
Comments
Post a Comment