Wandering through ScalaQuery source code I’ve found such declarations (many of the kind actually):
private[session] val dyn = new DynamicVariable[Session](null)
and
def forDataSource(ds: DataSource): Database = new Database {
protected[session] def createConnection(): Connection = ds.getConnection
}
What does that [session] mean? And I thought a function defined inside a function can not be protected…
But
createConnectionis not insideforDataSource, it’s insideDatabase— see thenew Database {on the previous line?It means that everything in the scope
session(which might be a class, object or package — I don’t know) can see that definition, plus the classes that extendDatabase.