I think I had a good understanding of Scala till I find myself in this simple scenario
sealed abstract case class Name private(name: String)
object Name {
def make(name: String): Option[Name] =
if (name.nonEmpty) Some(new Name(name) {}) else None
}
my question is about the private modifier for the class.
If I use it like this, everything works, but if I move the private keyword at the start, something like
private sealed abstract case class Name(name: String) it doesn't compile becuase gives me the following error
private class Name escapes its defining scope as part of type Option[example.package.Name]
where example.package is the package object I'm working in.
I think I need some clarification because I'm not sure what's happening here