I'm learning to scala and I'm seeing official document for style guide for scala. But I am confused why same expression is encourage and discourage at the same time.
According to scala style guide first package coolness
is wrong but the second package coolness
which is in middle of example, is right.
// wrong! this is definitely wrong
package coolness
// right! puts only coolness._ in scope
package com.novell.coolness
// right! puts both novell._ and coolness._ in scope
package com.novell
package coolness //but why is it OK?
// right, for package object com.novell.coolness
package com.novell
/**
* Provides classes related to coolness
*/
package object coolness {
}
Solved : I didn't know that package declaration that over 2lines is same as one line declaration separate with dot.
Speaking of,
package com.novell.coolness
is same package com.novell; package coolness