<?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>simonrichardson.info &#187; HaXe-C++</title> <atom:link href="http://www.simonrichardson.info/category/haxe/haxecpp/feed/" rel="self" type="application/rss+xml" /><link>http://www.simonrichardson.info</link> <description>ActionScript &#38; Android</description> <lastBuildDate>Mon, 05 Dec 2011 09:54:05 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>Interruption</title><link>http://www.simonrichardson.info/2010/05/06/interruption/</link> <comments>http://www.simonrichardson.info/2010/05/06/interruption/#comments</comments> <pubDate>Thu, 06 May 2010 15:59:55 +0000</pubDate> <dc:creator>Simon Richardson</dc:creator> <category><![CDATA[ActionScript]]></category> <category><![CDATA[ActionScript3]]></category> <category><![CDATA[HaXe]]></category> <category><![CDATA[HaXe-C++]]></category> <category><![CDATA[performance]]></category> <guid
isPermaLink="false">http://www.simonrichardson.info/?p=51</guid> <description><![CDATA[I know I&#8217;ve supposed to have written about Unit testing (part 3), it&#8217;s in draft and needs amending, but in the mean time I&#8217;ve been thinking about compilers and languages. I&#8217;ve been reading the dragon book of late, because I&#8217;ve needed to implement a coding style verifier and micro optimiser (something which has been talked [...]]]></description> <content:encoded><![CDATA[<p>I know I&#8217;ve supposed to have written about Unit testing (part 3), it&#8217;s in draft and needs amending, but in the mean time I&#8217;ve been thinking about compilers and languages. I&#8217;ve been reading the <a
href="http://en.wikipedia.org/wiki/Dragon_Book_(computer_science)">dragon book</a> of late, because I&#8217;ve needed to implement a coding style verifier and micro optimiser (something which has been talked about in length by developers).</p><p>One thing has struck me of late and that is; we do have really fast operational codes in the <a
href="http://www.ncannasse.fr/blog/adobe_alchemy">language</a>, but other than <a
href="http://haxe.org/">haXe</a> and <a
href="http://labs.adobe.com/technologies/alchemy/">Adobe Alchemy</a> not much is taking advantage of it. You can of course try and use <a
href="http://blog.joa-ebert.com/2009/08/05/turbodieselsportinjection/">TDSI</a> from <a
href="http://blog.joa-ebert.com/">Joa Ebert</a>, but why should we have to optimise something after we&#8217;ve written it? This should be either standard from the language or the compiler.</p><p><strong>So what is this really about?</strong><br
/> This is about wanting to code without thinking about optimising the basics, you don&#8217;t hear of C/C++/C#/Java developers talking about trying to squeeze every ounce of power from the language every time they code something. I&#8217;m not saying you shouldn&#8217;t optimise, what I am saying is that as a platform it always seems like we&#8217;re starting with a handicap.<br
/> I want the fasting language for the platform and have all the features for the language. I really like method overloading from Java. I know the AVM2 doesn&#8217;t support it by default, but that doesn&#8217;t stop you from implementing in some way. A perfect example of this is type parameters (generics) of the Vector class, which I really like from Java and HaXe, but why is it not default on all objects. The compiler checks what your implementing and the aligns it to correct compound types.</p><p>Now why can&#8217;t a language do this for method overloading, by simply changing the method signature to something else at compile time.</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td
class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">method</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">method</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> age<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #004993;">method</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'fred'</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #004993;">method</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">'jim'</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">24</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div><p>This would be translated to the following:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td
class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #339966; font-weight: bold;">function</span> method_StringVoid<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span>
<span style="color: #339966; font-weight: bold;">function</span> method_StringIntVoid<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> age<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
<span style="color: #000000;">&#125;</span>
method_StringVoid<span style="color: #000000;">&#40;</span><span style="color: #990000;">'fred'</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
method_StringIntVoid<span style="color: #000000;">&#40;</span><span style="color: #990000;">'jim'</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000; font-weight:bold;">24</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></td></tr></table></div><p>The reason for the curious method signature is to enable something to call the method if it&#8217;s not directly know i.e. external swf file etc.</p><p>Also why is the fastest int, not used automatically? To use the fastest int, you have to delve into opcodes, which seems extraordinary as you&#8217;re actually saying to your developers &#8220;we do have this really fast player, but you&#8217;re not allowed to use it&#8221;. It would be great if a language just used the fastest int and not require the developer to jump into another language (C/C++/haXe).</p> ]]></content:encoded> <wfw:commentRss>http://www.simonrichardson.info/2010/05/06/interruption/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
