<?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: Super need not apply, nor call	</title>
	<atom:link href="https://jessewarden.com/2004/05/super-need-not-apply-nor-call.html/feed" rel="self" type="application/rss+xml" />
	<link>https://jessewarden.com/2004/05/super-need-not-apply-nor-call.html</link>
	<description>Software &#124; Fitness &#124; Gaming</description>
	<lastBuildDate>Tue, 25 May 2004 18:26:55 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: erikbianchi		</title>
		<link>https://jessewarden.com/2004/05/super-need-not-apply-nor-call.html/comment-page-1#comment-1747</link>

		<dc:creator><![CDATA[erikbianchi]]></dc:creator>
		<pubDate>Tue, 25 May 2004 18:26:55 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=532#comment-1747</guid>

					<description><![CDATA[ok gotcha, minor disconnect.

just to point out super.constructor.apply will only ever target the top of your tree. So if you have a GrandParent, Parent and Child class if you apply super.constructor in child GrandParents constructor is applied and not Parents!

You could always define your own constructor type variable i.e.:

function GrandParent(){}

function Parent(){
	this.parent = this;
}

Parent.prototype = new GrandParent();

function Child(){
	this.parent.apply(foo,bar);
}

Child.prototype = new Parent();

However, in either case I think if you where to come back to your code a few months later it wouldn?t be as readable imo.

-erik
]]></description>
			<content:encoded><![CDATA[<p>ok gotcha, minor disconnect.</p>
<p>just to point out super.constructor.apply will only ever target the top of your tree. So if you have a GrandParent, Parent and Child class if you apply super.constructor in child GrandParents constructor is applied and not Parents!</p>
<p>You could always define your own constructor type variable i.e.:</p>
<p>function GrandParent(){}</p>
<p>function Parent(){<br />
	this.parent = this;<br />
}</p>
<p>Parent.prototype = new GrandParent();</p>
<p>function Child(){<br />
	this.parent.apply(foo,bar);<br />
}</p>
<p>Child.prototype = new Parent();</p>
<p>However, in either case I think if you where to come back to your code a few months later it wouldn?t be as readable imo.</p>
<p>-erik</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Kenny Bunch		</title>
		<link>https://jessewarden.com/2004/05/super-need-not-apply-nor-call.html/comment-page-1#comment-1746</link>

		<dc:creator><![CDATA[Kenny Bunch]]></dc:creator>
		<pubDate>Tue, 25 May 2004 17:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=532#comment-1746</guid>

					<description><![CDATA[Why not initialize non visual data in the constructor and only leave visual prop inits to the init? If you had a class that could exist beyond the frame of the visual, then you could maintain non visual data and then just reinitialize your visuals when it came into existence again. Object creation is a real process worker. You can create creation factories that reuse objects and lessen the need of constant instantiation.]]></description>
			<content:encoded><![CDATA[<p>Why not initialize non visual data in the constructor and only leave visual prop inits to the init? If you had a class that could exist beyond the frame of the visual, then you could maintain non visual data and then just reinitialize your visuals when it came into existence again. Object creation is a real process worker. You can create creation factories that reuse objects and lessen the need of constant instantiation.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: JesterXL		</title>
		<link>https://jessewarden.com/2004/05/super-need-not-apply-nor-call.html/comment-page-1#comment-1745</link>

		<dc:creator><![CDATA[JesterXL]]></dc:creator>
		<pubDate>Tue, 25 May 2004 14:04:20 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=532#comment-1745</guid>

					<description><![CDATA[Yep.

function Person(name, age, gender)
{
   init(name, age, gender);
}

function init(name, age, gender)
{
   this.name = name;
   this.age = age;
   this.gender = gender;
}

vs.

function Person()
{
   init.apply(this, arguments); 
}

function init(name, age, gender)
{
   this.name = name;
   this.age = age;
   this.gender = gender;
}


That way, I only I need to write them once!]]></description>
			<content:encoded><![CDATA[<p>Yep.</p>
<p>function Person(name, age, gender)<br />
{<br />
   init(name, age, gender);<br />
}</p>
<p>function init(name, age, gender)<br />
{<br />
   this.name = name;<br />
   this.age = age;<br />
   this.gender = gender;<br />
}</p>
<p>vs.</p>
<p>function Person()<br />
{<br />
   init.apply(this, arguments);<br />
}</p>
<p>function init(name, age, gender)<br />
{<br />
   this.name = name;<br />
   this.age = age;<br />
   this.gender = gender;<br />
}</p>
<p>That way, I only I need to write them once!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Wes Carr		</title>
		<link>https://jessewarden.com/2004/05/super-need-not-apply-nor-call.html/comment-page-1#comment-1744</link>

		<dc:creator><![CDATA[Wes Carr]]></dc:creator>
		<pubDate>Tue, 25 May 2004 11:17:59 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=532#comment-1744</guid>

					<description><![CDATA[From what I gathered, Jester was trying to use apply or call, because he didn&#039;t want to handle the constructor parameters individually when calling the super constructor, which is very convenient any many instances.]]></description>
			<content:encoded><![CDATA[<p>From what I gathered, Jester was trying to use apply or call, because he didn&#8217;t want to handle the constructor parameters individually when calling the super constructor, which is very convenient any many instances.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: erikbianchi		</title>
		<link>https://jessewarden.com/2004/05/super-need-not-apply-nor-call.html/comment-page-1#comment-1743</link>

		<dc:creator><![CDATA[erikbianchi]]></dc:creator>
		<pubDate>Tue, 25 May 2004 07:44:09 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=532#comment-1743</guid>

					<description><![CDATA[Uhmmmm, i don&#039;t get it? What are you trying to do? Just pass aruments to the parent constructor?

Does this not do the trick?

function a(target){
	this.target = target;
}

function b(target){
	super(target);
}

b.prototype = new a();

b.prototype.getTarget = function(){
	trace(this.target);
};

c = new b(&quot;Foo&quot;);
c.getTarget();]]></description>
			<content:encoded><![CDATA[<p>Uhmmmm, i don&#8217;t get it? What are you trying to do? Just pass aruments to the parent constructor?</p>
<p>Does this not do the trick?</p>
<p>function a(target){<br />
	this.target = target;<br />
}</p>
<p>function b(target){<br />
	super(target);<br />
}</p>
<p>b.prototype = new a();</p>
<p>b.prototype.getTarget = function(){<br />
	trace(this.target);<br />
};</p>
<p>c = new b(&#8220;Foo&#8221;);<br />
c.getTarget();</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
