<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>rel=me &#187; splat</title>
	<atom:link href="http://rel.me/t/splat/feed/" rel="self" type="application/rss+xml" />
	<link>http://rel.me</link>
	<description>programming, objective-c, cocoa, iphone, c</description>
	<lastBuildDate>Wed, 01 Feb 2012 07:26:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Actionscript splat (argument unpacking)</title>
		<link>http://rel.me/2008/02/14/actionscript-splat-argument-unpacking/</link>
		<comments>http://rel.me/2008/02/14/actionscript-splat-argument-unpacking/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 21:33:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[argument]]></category>
		<category><![CDATA[splat]]></category>
		<category><![CDATA[unpacking]]></category>

		<guid isPermaLink="false">/2008/03/18/actionscript-splat-argument-unpacking</guid>
		<description><![CDATA[In actionscript there is no splat operator or argument unpacking. In the case where you want to proxy calls to vararg methods you have to use the Function#apply() method. var array:Array = &#91;&#93;; var stuffToAdd:Array = &#91; 1, 2, 3, 4 &#93;; &#160; array.push.apply&#40;array, stuffToAdd&#41;; It would be nice to have a splat/unpack operator: array.push&#40;*stuffToAdd&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>In actionscript there is no <a href="http://redhanded.hobix.com/bits/theSiphoningSplat.html">splat operator</a> or <a href="http://docs.python.org/tut/node6.html#SECTION006740000000000000000">argument unpacking</a>.</p>
<p>In the case where you want to proxy calls to vararg methods you have to use the <a href="http://livedocs.adobe.com/labs/flex3/langref/Function.html#apply()">Function#apply()</a> method.</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span class="kw2">var</span> <span class="kw3">array</span>:<span class="kw3">Array</span> = <span class="br0">&#91;</span><span class="br0">&#93;</span>;
<span class="kw2">var</span> stuffToAdd:<span class="kw3">Array</span> = <span class="br0">&#91;</span> <span class="nu0">1</span>, <span class="nu0">2</span>, <span class="nu0">3</span>, <span class="nu0">4</span> <span class="br0">&#93;</span>;
&nbsp;
<span class="kw3">array</span>.<span class="kw3">push</span>.<span class="kw3">apply</span><span class="br0">&#40;</span><span class="kw3">array</span>, stuffToAdd<span class="br0">&#41;</span>;</pre></div></div>

<p>It would be nice to have a splat/unpack operator:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript"><span class="kw3">array</span>.<span class="kw3">push</span><span class="br0">&#40;</span><span class="sy0">*</span>stuffToAdd<span class="br0">&#41;</span>;
<span class="co1">// Or</span>
<span class="kw3">array</span>.<span class="kw3">push</span><span class="br0">&#40;</span>... <span class="me1">stuffToAdd</span><span class="br0">&#41;</span>;</pre></div></div>

<p>The <a href="http://www.google.com/search?q=ecmascript+splat+operator">ecma mailing list</a> discussed this use of <a href="http://www.nabble.com/forum/ViewPost.jtp?post=14450724&#038;framed=y">super.apply(this, arguments)</a>. And specifically regarding argument unpacking in AS3: </p>
<blockquote><p>
We dropped this from AS3 for lack of evidence for its need.
</p></blockquote>
<p>I think any language with <tt>(... args)</tt> to <tt>Array</tt> needs the <tt>Array</tt> to <tt>(... args)</tt> if not for anything other than completeness. Does anyone know if this is planned for ES4 at least?</p>
]]></content:encoded>
			<wfw:commentRss>http://rel.me/2008/02/14/actionscript-splat-argument-unpacking/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

