Is there an access modifier [Edit: or an idiomatic workaround which achieves the same thing] which will allow a Scala name/object to be visible to all the code in the same file, but not the whole package the file is part of?
package org.example.foo
private object SharedStuff {
val bar = 0
}
class Foo {
def apply(x: Int): String = ... something involving SharedStuff.bar ...
}
class Fuz {
def fuzz(t: String): Int = ... something else involving SharedStuff.bar ...
}
In its current state, the object SharedStuff will be visible to all code in package foo. I'd like it to be visible to the classes Foo and Fuz only, without making an explicit subpackage to enclose this file.
No, there is no such modifier.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With