<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How packages work in Scala</title>
	<atom:link href="http://www.drmaciver.com/2009/07/how-packages-work-in-scala/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.drmaciver.com/2009/07/how-packages-work-in-scala/</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 22:56:11 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dean Thompson</title>
		<link>http://www.drmaciver.com/2009/07/how-packages-work-in-scala/#comment-1569</link>
		<dc:creator>Dean Thompson</dc:creator>
		<pubDate>Fri, 01 Apr 2011 14:31:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/?p=1369#comment-1569</guid>
		<description>Here&#039;s the Scala 2.8 solution: http://www.artima.com/scalazine/articles/chained_package_clauses_in_scala.html</description>
		<content:encoded><![CDATA[<p>Here&#8217;s the Scala 2.8 solution: <a href="http://www.artima.com/scalazine/articles/chained_package_clauses_in_scala.html" rel="nofollow">http://www.artima.com/scalazine/articles/chained_package_clauses_in_scala.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ittay</title>
		<link>http://www.drmaciver.com/2009/07/how-packages-work-in-scala/#comment-1000</link>
		<dc:creator>ittay</dc:creator>
		<pubDate>Thu, 01 Oct 2009 05:04:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/?p=1369#comment-1000</guid>
		<description>I agree with @Gary. As far as I could see, this feature means only something I can trip over and requires me to think more carefully about how I name packages. Where does it come in handy? 

Also, why couldn&#039;t packages be &quot;reopened&quot; instead of being always shadowed? That way, in the example, kittens would have been added to the existing &#039;java&#039; namespace.</description>
		<content:encoded><![CDATA[<p>I agree with @Gary. As far as I could see, this feature means only something I can trip over and requires me to think more carefully about how I name packages. Where does it come in handy? </p>
<p>Also, why couldn&#8217;t packages be &#8220;reopened&#8221; instead of being always shadowed? That way, in the example, kittens would have been added to the existing &#8216;java&#8217; namespace.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gary</title>
		<link>http://www.drmaciver.com/2009/07/how-packages-work-in-scala/#comment-969</link>
		<dc:creator>Gary</dc:creator>
		<pubDate>Sat, 08 Aug 2009 15:58:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/?p=1369#comment-969</guid>
		<description>The article starts by saying that people often don&#039;t get to stage 5, acceptance, and that the package system is actually &quot;quite nice.&quot; But the article only goes on to decribe the problems of shadowing and package hijacking. What are the positives that make these risks worthwhile? What the practices enabled by the current scheme that are quite nice? Take us to stage 5!</description>
		<content:encoded><![CDATA[<p>The article starts by saying that people often don&#8217;t get to stage 5, acceptance, and that the package system is actually &#8220;quite nice.&#8221; But the article only goes on to decribe the problems of shadowing and package hijacking. What are the positives that make these risks worthwhile? What the practices enabled by the current scheme that are quite nice? Take us to stage 5!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bhaskar Maddala</title>
		<link>http://www.drmaciver.com/2009/07/how-packages-work-in-scala/#comment-960</link>
		<dc:creator>Bhaskar Maddala</dc:creator>
		<pubDate>Sat, 18 Jul 2009 14:15:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/?p=1369#comment-960</guid>
		<description>It is perfectly acceptable for me to want to live long, actually really long. :)
package woodoo.charlaton{
    object trickery {
        private def doSomeMagic = java.lang.Math.random * 100
        def liveLong = if(doSomeMagic == 1000) &quot;You will live long&quot; else &quot;Die  Now!!&quot;
    }

    package java.lang{
        object Math{
            val random = 10
        }
    }
}
it occurs to me that most people are thinking of packages in scala as a means of code organization (coming from a Java world, this is the immediate model) rather than as nested structures and are as a result put off by what they might consider to be name shadowing.

However I am not certain that any of your proposed solutions on naming conventions

- Public projects simply get shortened to projectname as the top level package
- Private projects get shortened to companyname.projectname
- Packages structures are kept fairly shallow

resolves the issue. They just make it easier for programmers to use the feature without understanding it, but in my experience this results in more poorly written code in the long run.

If such conventions were to be used on a code base, I would add to the above proposed solution on naming conventions

- All packages must contain an object or class type

As an example
net.webbify.controller would become just controller dropping the TLD and projectname (if webbify has no object or type classes)

This enforces your third criterion of keeping package structures shallow.

You indicate that most people have taken to fully qualifying imports. This is only required in the cases where the type being referenced is from a third party source.

I like my packages as they are now</description>
		<content:encoded><![CDATA[<p>It is perfectly acceptable for me to want to live long, actually really long. :)<br />
package woodoo.charlaton{<br />
    object trickery {<br />
        private def doSomeMagic = java.lang.Math.random * 100<br />
        def liveLong = if(doSomeMagic == 1000) &#8220;You will live long&#8221; else &#8220;Die  Now!!&#8221;<br />
    }</p>
<p>    package java.lang{<br />
        object Math{<br />
            val random = 10<br />
        }<br />
    }<br />
}<br />
it occurs to me that most people are thinking of packages in scala as a means of code organization (coming from a Java world, this is the immediate model) rather than as nested structures and are as a result put off by what they might consider to be name shadowing.</p>
<p>However I am not certain that any of your proposed solutions on naming conventions</p>
<p>- Public projects simply get shortened to projectname as the top level package<br />
- Private projects get shortened to companyname.projectname<br />
- Packages structures are kept fairly shallow</p>
<p>resolves the issue. They just make it easier for programmers to use the feature without understanding it, but in my experience this results in more poorly written code in the long run.</p>
<p>If such conventions were to be used on a code base, I would add to the above proposed solution on naming conventions</p>
<p>- All packages must contain an object or class type</p>
<p>As an example<br />
net.webbify.controller would become just controller dropping the TLD and projectname (if webbify has no object or type classes)</p>
<p>This enforces your third criterion of keeping package structures shallow.</p>
<p>You indicate that most people have taken to fully qualifying imports. This is only required in the cases where the type being referenced is from a third party source.</p>
<p>I like my packages as they are now</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: david</title>
		<link>http://www.drmaciver.com/2009/07/how-packages-work-in-scala/#comment-959</link>
		<dc:creator>david</dc:creator>
		<pubDate>Fri, 17 Jul 2009 14:31:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.drmaciver.com/?p=1369#comment-959</guid>
		<description>My naming conventions are basically as follows:

- Public projects simply get shortened to projectname as the top level package
- Private projects get shortened to companyname.projectname
- Packages structures are kept fairly shallow

It&#039;s almost functionally equivalent to just dropping the TLD, so

com.foo.bar

becomes 

foo.bar</description>
		<content:encoded><![CDATA[<p>My naming conventions are basically as follows:</p>
<p>- Public projects simply get shortened to projectname as the top level package<br />
- Private projects get shortened to companyname.projectname<br />
- Packages structures are kept fairly shallow</p>
<p>It&#8217;s almost functionally equivalent to just dropping the TLD, so</p>
<p>com.foo.bar</p>
<p>becomes </p>
<p>foo.bar</p>
]]></content:encoded>
	</item>
</channel>
</rss>

