<?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: Top 5 Things to Know About Constructors in Scala</title>
	<atom:link href="http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/feed/" rel="self" type="application/rss+xml" />
	<link>http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/</link>
	<description></description>
	<lastBuildDate>Wed, 09 May 2012 22:39:34 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Nicholas Sterling</title>
		<link>http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/comment-page-1/#comment-859908</link>
		<dc:creator>Nicholas Sterling</dc:creator>
		<pubDate>Wed, 08 Feb 2012 19:07:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemonkeyism.com/?p=695#comment-859908</guid>
		<description>I just wanted to say that I discovered this compilation several months ago and have found it enormously helpful.  This info deserves to live in condensed form on the scala-lang web site as a cheatsheet.

One thing that would make this info more readily useful (and in fact I&#039;ve done this on my paper copy of this site) is to emphasize (bold or underline) the key part of the Scala code that gives you the effect you are demonstrating.  So, for example, in part one &quot;val bar:Bar&quot; is emphasized, in part two &quot;private&quot;, in part three &quot;extends SuperFoo(bar)&quot;, in part four the second line, and in part 5 &quot;@BeanProperty var&quot;.  The value in doing this is that you immediately know that no changes were required anywhere else.

Oh, and Paul&#039;s comment on how to make a constructor private has been very helpful; since constructors are chained, that&#039;s what you have to do if you are going to store the data in a different form from what the user hands you to create it.  Would it make sense to add that tip to your collection?

One last note is that the rules are somewhat modified for case classes.

Thanks very much for taking the time to write this down, Stephan; you materially contributed to my success with Scala!</description>
		<content:encoded><![CDATA[<p>I just wanted to say that I discovered this compilation several months ago and have found it enormously helpful.  This info deserves to live in condensed form on the scala-lang web site as a cheatsheet.</p>
<p>One thing that would make this info more readily useful (and in fact I&#8217;ve done this on my paper copy of this site) is to emphasize (bold or underline) the key part of the Scala code that gives you the effect you are demonstrating.  So, for example, in part one &#8220;val bar:Bar&#8221; is emphasized, in part two &#8220;private&#8221;, in part three &#8220;extends SuperFoo(bar)&#8221;, in part four the second line, and in part 5 &#8220;@BeanProperty var&#8221;.  The value in doing this is that you immediately know that no changes were required anywhere else.</p>
<p>Oh, and Paul&#8217;s comment on how to make a constructor private has been very helpful; since constructors are chained, that&#8217;s what you have to do if you are going to store the data in a different form from what the user hands you to create it.  Would it make sense to add that tip to your collection?</p>
<p>One last note is that the rules are somewhat modified for case classes.</p>
<p>Thanks very much for taking the time to write this down, Stephan; you materially contributed to my success with Scala!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: some random dude</title>
		<link>http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/comment-page-1/#comment-331364</link>
		<dc:creator>some random dude</dc:creator>
		<pubDate>Fri, 24 Sep 2010 14:14:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemonkeyism.com/?p=695#comment-331364</guid>
		<description>Just a tip regarding your additional tip;
it&#039;s @serializable
Case sensitive.

Yeah... I know ;D</description>
		<content:encoded><![CDATA[<p>Just a tip regarding your additional tip;<br />
it&#8217;s @serializable<br />
Case sensitive.</p>
<p>Yeah&#8230; I know ;D</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Knowtu &#187; links for 2010-01-08</title>
		<link>http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/comment-page-1/#comment-263418</link>
		<dc:creator>Knowtu &#187; links for 2010-01-08</dc:creator>
		<pubDate>Sat, 09 Jan 2010 01:30:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemonkeyism.com/?p=695#comment-263418</guid>
		<description>[...] Code Monkeyism: Top 5 Things to Know About Constructors in Scala (tags: scala) [...]</description>
		<content:encoded><![CDATA[<p>[...] Code Monkeyism: Top 5 Things to Know About Constructors in Scala (tags: scala) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Phillips</title>
		<link>http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/comment-page-1/#comment-228808</link>
		<dc:creator>Paul Phillips</dc:creator>
		<pubDate>Wed, 22 Apr 2009 12:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemonkeyism.com/?p=695#comment-228808</guid>
		<description>Since it took me a long time to figure out it was even possible back in the day, how to have a private primary constructor:

class Foo private (x: Int) { }</description>
		<content:encoded><![CDATA[<p>Since it took me a long time to figure out it was even possible back in the day, how to have a private primary constructor:</p>
<p>class Foo private (x: Int) { }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: eivindw</title>
		<link>http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/comment-page-1/#comment-228807</link>
		<dc:creator>eivindw</dc:creator>
		<pubDate>Wed, 22 Apr 2009 12:11:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemonkeyism.com/?p=695#comment-228807</guid>
		<description>&gt;To add getBar and setBar but not a public &gt;field you need to:
&gt;
&gt;class Foo(aBar:Bar) {
&gt;    @BeanProperty
&gt;    private val bar = aBar
&gt;}

For the setter to work I think you should define bar as a var, not val?

private var bar = aBar</description>
		<content:encoded><![CDATA[<p>&gt;To add getBar and setBar but not a public &gt;field you need to:<br />
&gt;<br />
&gt;class Foo(aBar:Bar) {<br />
&gt;    @BeanProperty<br />
&gt;    private val bar = aBar<br />
&gt;}</p>
<p>For the setter to work I think you should define bar as a var, not val?</p>
<p>private var bar = aBar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tuomas</title>
		<link>http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/comment-page-1/#comment-228805</link>
		<dc:creator>Tuomas</dc:creator>
		<pubDate>Wed, 22 Apr 2009 11:58:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemonkeyism.com/?p=695#comment-228805</guid>
		<description>The second case is shorter with

class Foo(private val bar: Bar) 

or just

class Foo(bar: Bar)</description>
		<content:encoded><![CDATA[<p>The second case is shorter with</p>
<p>class Foo(private val bar: Bar) </p>
<p>or just</p>
<p>class Foo(bar: Bar)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/comment-page-1/#comment-228804</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 22 Apr 2009 11:41:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemonkeyism.com/?p=695#comment-228804</guid>
		<description>2. How to have private fields

more concisely:

class Foo(private val bar: Bar) { 
  ...
}</description>
		<content:encoded><![CDATA[<p>2. How to have private fields</p>
<p>more concisely:</p>
<p>class Foo(private val bar: Bar) {<br />
  &#8230;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesper Nordenberg</title>
		<link>http://codemonkeyism.com/top-5-things-to-know-about-constructors-in-scala/comment-page-1/#comment-228803</link>
		<dc:creator>Jesper Nordenberg</dc:creator>
		<pubDate>Wed, 22 Apr 2009 11:39:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.codemonkeyism.com/?p=695#comment-228803</guid>
		<description>Actually you can write &quot;class Foo(private val bar : Bar)&quot;.</description>
		<content:encoded><![CDATA[<p>Actually you can write &#8220;class Foo(private val bar : Bar)&#8221;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching using disk
Object Caching 336/337 objects using disk

Served from: codemonkeyism.com @ 2012-05-22 22:33:57 -->
