I am new to scala and don't know what does private[wikipedia]
mean,could anyone please tell me?Is it a generic type?
package wikipedia
import scala.io.Source
object WikipediaData {
private[wikipedia] def lines: List[String] = ???
I am new to scala and don't know what does private[wikipedia]
mean,could anyone please tell me?Is it a generic type?
package wikipedia
import scala.io.Source
object WikipediaData {
private[wikipedia] def lines: List[String] = ???
It's a way to scope the privacy of a given object. So private[wiki]
means only code defined within wiki
has access to lines
.
See here: https://alvinalexander.com/scala/how-to-control-scala-method-scope-object-private-package/
private[packageX] means the following method/class/object/constructor is accessible only from within that package - in this case syntax is the package name, and this constructor is only accessible from other code inside syntax package.