Should inner modules have access to its parent's definitions? #87
Replies: 3 comments 4 replies
-
IMO keep this interaction (with the caveat below); You have two scenarios:
Example: module Outer {
var x: int
def x_plus(z) = x + z
module Inner {
val x2 = x + x
}
module Inner2 {
const N: int
val y = x + N
}
pred inv = (Inner.x2 - x == x)
} TLDR: Scala analogue - nested modules with no constants are |
Beta Was this translation helpful? Give feedback.
-
I think it's good to keep. It's listed in the doc as the recommended way to keep some names hidden, e.g.
to hide F(x) outside of Local. In such a case, both directions are important to have. This seems to also be the behaviour for nested classes in Java, e.g. see https://stackoverflow.com/questions/5770575/can-an-outer-class-access-the-members-of-inner-classe |
Beta Was this translation helpful? Give feedback.
-
This discussion is not relevant anymore, since we have removed nested modules. |
Beta Was this translation helpful? Give feedback.
-
Our docs currently state that nested modules have access to its outer modules definitions. This implies a bidirectional interaction since the outer module can also access it's inner module's values with
InnerModuleName::definitionName
like expressions. Should we get rid of this behavior?@konnov @shonfeder @Kukovec @thpani @rodrigo7491 @p-offtermatt what is your opinion on this inner propagation?
Beta Was this translation helpful? Give feedback.
All reactions