<?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: Enforcing `new` in constructors</title>
	<atom:link href="http://www.jspatterns.com/enforcing-new-in-constructors/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jspatterns.com/enforcing-new-in-constructors/</link>
	<description>Exploring common JavaScript patterns and anti-patterns</description>
	<lastBuildDate>Fri, 03 Feb 2012 21:54:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
	<item>
		<title>By: Dre Beats Headphones</title>
		<link>http://www.jspatterns.com/enforcing-new-in-constructors/#comment-41813</link>
		<dc:creator>Dre Beats Headphones</dc:creator>
		<pubDate>Fri, 16 Dec 2011 04:33:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=53#comment-41813</guid>
		<description>Just added this blog to my favorites. I enjoy reading your blogs and hope you maintain them coming!</description>
		<content:encoded><![CDATA[<p>Just added this blog to my favorites. I enjoy reading your blogs and hope you maintain them coming!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mira</title>
		<link>http://www.jspatterns.com/enforcing-new-in-constructors/#comment-6720</link>
		<dc:creator>Mira</dc:creator>
		<pubDate>Mon, 08 Nov 2010 17:02:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=53#comment-6720</guid>
		<description>function MyClass(name) {
if (!(this instanceof MyClass)) return new MyClass();

this.name = name;
// more initialisation

return this;
}</description>
		<content:encoded><![CDATA[<p>function MyClass(name) {<br />
if (!(this instanceof MyClass)) return new MyClass();</p>
<p>this.name = name;<br />
// more initialisation</p>
<p>return this;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phoscur</title>
		<link>http://www.jspatterns.com/enforcing-new-in-constructors/#comment-2181</link>
		<dc:creator>Phoscur</dc:creator>
		<pubDate>Mon, 22 Feb 2010 00:38:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=53#comment-2181</guid>
		<description>function Constructor() {
  var that = (this === window) ? {} : this;
  ...
  return that;
}
I hope you aren&#039;t serious with this. It just doesn&#039;t make sense, as JavaScript always invokes the function as a non-constructor (if you put a new before just doesn&#039;t matter) because it returns something. The condition is always true and thereby unneeded.</description>
		<content:encoded><![CDATA[<p>function Constructor() {<br />
  var that = (this === window) ? {} : this;<br />
  &#8230;<br />
  return that;<br />
}<br />
I hope you aren&#8217;t serious with this. It just doesn&#8217;t make sense, as JavaScript always invokes the function as a non-constructor (if you put a new before just doesn&#8217;t matter) because it returns something. The condition is always true and thereby unneeded.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

