3 ms·
> Scala doesn't support top-level functions (only singleton objects) This is neither here nor there. Scala has "package objects" and functions put into a packa
by nessus42 14y ago
> Scala doesn't support top-level functions (only singleton objects)
This is neither here nor there. Scala has "package objects" and functions put into a package object are scoped directly at the top level of the package. They are not nested within any other object. The only downside to this that I can see, is that at the moment, a package can only have a single package object, which means all the top-level functions for the package have to reside within a single file.