<?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: Duck Typing on JavaScript, and getter/setter</title>
	<atom:link href="http://blog.nydd.org/2008/10/duck-typing-on-javascript-and-gettersetter/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nydd.org/2008/10/duck-typing-on-javascript-and-gettersetter/</link>
	<description>Art, Hack and Rock'n Roll</description>
	<lastBuildDate>Tue, 13 Oct 2009 17:58:10 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: beatak</title>
		<link>http://blog.nydd.org/2008/10/duck-typing-on-javascript-and-gettersetter/comment-page-1/#comment-125</link>
		<dc:creator>beatak</dc:creator>
		<pubDate>Tue, 25 Nov 2008 23:56:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nydd.org/?p=67#comment-125</guid>
		<description>I&#039;m not 100% sure what Daniel means by that code... it looks like a using String as Array-like access?  It should work if you fix as below, but I think it less efficient.

&lt;code&gt;
var c = function(a, len) 
{
  if (len &gt; 0) 
  {
    return a[len].join( c(a, len - 1) );
  } else {
    return a[0];
  }
};
var string = c(target, target.length);
&lt;/code&gt;</description>
		<content:encoded><![CDATA[							<p>I&#8217;m not 100% sure what Daniel means by that code&#8230; it looks like a using String as Array-like access?  It should work if you fix as below, but I think it less efficient.</p>
							<p><code><br />
							var c = function(a, len)<br />
							{<br />
							  if (len &gt; 0)<br />
							  {<br />
							    return a[len].join( c(a, len - 1) );<br />
							  } else {<br />
							    return a[0];<br />
							  }<br />
							};<br />
							var string = c(target, target.length);<br />
							</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel</title>
		<link>http://blog.nydd.org/2008/10/duck-typing-on-javascript-and-gettersetter/comment-page-1/#comment-124</link>
		<dc:creator>Daniel</dc:creator>
		<pubDate>Tue, 25 Nov 2008 23:36:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nydd.org/?p=67#comment-124</guid>
		<description>What about a recursive function? I&#039;m not familiar with javascript (so this is probably not valid syntax), but the concatenation function could potentially look like:

var string = (c: function(a, len) {if (len &gt; 0) {return a[len].join(c(a, len - 1));} else {return a[0];}});</description>
		<content:encoded><![CDATA[							<p>What about a recursive function? I&#8217;m not familiar with javascript (so this is probably not valid syntax), but the concatenation function could potentially look like:</p>
							<p>var string = (c: function(a, len) {if (len &gt; 0) {return a[len].join(c(a, len &#8211; 1));} else {return a[0];}});</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: beatak</title>
		<link>http://blog.nydd.org/2008/10/duck-typing-on-javascript-and-gettersetter/comment-page-1/#comment-99</link>
		<dc:creator>beatak</dc:creator>
		<pubDate>Fri, 31 Oct 2008 23:23:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nydd.org/?p=67#comment-99</guid>
		<description>What I really think interesting about is that this is somehow tricky and you don&#039;t have to know to do the things in JavaScript (unless you need a speed), but on the other hand it gives such a simplicity and potential.  Thanks for letting me know!</description>
		<content:encoded><![CDATA[							<p>What I really think interesting about is that this is somehow tricky and you don&#8217;t have to know to do the things in JavaScript (unless you need a speed), but on the other hand it gives such a simplicity and potential.  Thanks for letting me know!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mauvis</title>
		<link>http://blog.nydd.org/2008/10/duck-typing-on-javascript-and-gettersetter/comment-page-1/#comment-97</link>
		<dc:creator>Mauvis</dc:creator>
		<pubDate>Fri, 31 Oct 2008 17:11:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.nydd.org/?p=67#comment-97</guid>
		<description>In hindsight there was no reason for me to use a closure in my response and it should have been more like: 


function concatenate(){
    var string = Array.prototype.slice.call(arguments).join(&#039;&#039;);
    return string;
}


Still the third response is better since we&#039;re just borrowing the join prototype off the Array object instead of converting the arguments object to an array and then calling it&#039;s  join method.

Nice writeup!</description>
		<content:encoded><![CDATA[							<p>In hindsight there was no reason for me to use a closure in my response and it should have been more like: </p>
							<p>function concatenate(){<br />
							    var string = Array.prototype.slice.call(arguments).join(&#8221;);<br />
							    return string;<br />
							}</p>
							<p>Still the third response is better since we&#8217;re just borrowing the join prototype off the Array object instead of converting the arguments object to an array and then calling it&#8217;s  join method.</p>
							<p>Nice writeup!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
