<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Andy Li’s Blog</title><link href="https://blog.onthewings.net/" rel="alternate"></link><link href="http://feeds.feedburner.com/feed/atom.xml" rel="self"></link><id>https://blog.onthewings.net/</id><updated>2016-02-02T00:00:00+08:00</updated><entry><title>Haxe Packages Arrived at Official Arch Linux and openSUSE Repositories</title><link href="https://blog.onthewings.net/2016/02/02/haxe_packages_arrived_at_official_arch_linux_and_opensuse_repos/" rel="alternate"></link><published>2016-02-02T00:00:00+08:00</published><updated>2016-02-02T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2016-02-02:/2016/02/02/haxe_packages_arrived_at_official_arch_linux_and_opensuse_repos/</id><summary type="html">&lt;p&gt;Yes, our Haxe and Neko packages have arrived at official Arch Linux and openSUSE repositories!&lt;/p&gt;
&lt;h2&gt;Haxe in the Arch Linux “community” repository&lt;/h2&gt;
&lt;p&gt;There were already nice Haxe and Neko packages existed in the &lt;a href="https://aur.archlinux.org/"&gt;Arch User Repository (&lt;span class="caps"&gt;AUR&lt;/span&gt;)&lt;/a&gt;, which is somewhat like a Ubuntu &lt;span class="caps"&gt;PPA&lt;/span&gt;, except that &lt;span class="caps"&gt;AUR&lt;/span&gt; stores only source …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Yes, our Haxe and Neko packages have arrived at official Arch Linux and openSUSE repositories!&lt;/p&gt;
&lt;h2&gt;Haxe in the Arch Linux “community” repository&lt;/h2&gt;
&lt;p&gt;There were already nice Haxe and Neko packages existed in the &lt;a href="https://aur.archlinux.org/"&gt;Arch User Repository (&lt;span class="caps"&gt;AUR&lt;/span&gt;)&lt;/a&gt;, which is somewhat like a Ubuntu &lt;span class="caps"&gt;PPA&lt;/span&gt;, except that &lt;span class="caps"&gt;AUR&lt;/span&gt; stores only source tar balls. It means that people using the &lt;span class="caps"&gt;AUR&lt;/span&gt; will still have to get the tar balls and then build the packages. It is, therefore, time-consuming.&lt;/p&gt;
&lt;p&gt;The Haxe and Neko packages are now moved to &lt;a href="https://wiki.archlinux.org/index.php/official_repositories#community"&gt;“community”&lt;/a&gt;, which is one of the Arch Linux official repositories, which stores both source and binary packages. The Arch Linux package management tool, pacman, can directly install built packages from those official repositories. Therefore, installing Haxe and Neko is now as easy as issuing a single command: &lt;code&gt;sudo pacman -S haxe&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Packages in the “community” repository can only be submitted and maintained by &lt;a href="https://wiki.archlinux.org/index.php/Trusted_Users"&gt;“Trusted Users”&lt;/a&gt;. The Haxe and Neko packages are kindly maintained by &lt;a href="https://aur.archlinux.org/account/xyproto"&gt;Alexander Rødseth&lt;/a&gt;. I will also try assist him to update the packages when new versions are released.&lt;/p&gt;
&lt;h2&gt;Haxe in openSUSE Factory&lt;/h2&gt;
&lt;p&gt;I’ve created a &lt;a href="https://build.opensuse.org/project/show/devel:languages:haxe"&gt;devel project&lt;/a&gt; for Haxe in the openSUSE Build Service &lt;a href="https://blog.onthewings.net/2015/11/01/haxe_rpm_packages_for_fedora_and_opensuse/"&gt;as mentioned previously&lt;/a&gt;. People can use that to install Haxe and Neko packages on openSUSE, but they were not openSUSE official packages.&lt;/p&gt;
&lt;p&gt;After months of submissions and revisions, the Haxe and Neko packages are now accepted into &lt;a href="https://en.opensuse.org/Portal:Factory"&gt;openSUSE Factory&lt;/a&gt;. It means that if you’re using Tumbleweed, openSUSE’s rolling release, you will be able to install Haxe and Neko simply by &lt;code&gt;sudo zypper install haxe&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Haxe ♥ Linux&lt;/h2&gt;
&lt;p&gt;As of now, we’ve packages for Debian, Ubuntu, Fedora, openSUSE, and Arch Linux. All the info and installation instructions of the Haxe Foundation maintained packages are documented in the &lt;a href="http://haxe.org/download/linux"&gt;haxe.org Linux Software Packages page&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;According to the &lt;a href="https://blog.onthewings.net/2015/11/14/haxe_usage_survey/"&gt;Haxe usage survey&lt;/a&gt;, we covered most users’ need. We will provide packages for other Linux distros when they become popular. If you want to create Haxe packages for other distros, go ahead and &lt;a href="https://github.com/HaxeFoundation/haxe/issues"&gt;let us know&lt;/a&gt; when you’ve any question.&lt;/p&gt;</content><category term="Haxe"></category><category term="Arch Linux"></category><category term="openSUSE"></category></entry><entry><title>Haxe Usage Survey</title><link href="https://blog.onthewings.net/2015/11/14/haxe_usage_survey/" rel="alternate"></link><published>2015-11-14T00:00:00+08:00</published><updated>2015-11-14T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2015-11-14:/2015/11/14/haxe_usage_survey/</id><summary type="html">&lt;p&gt;Last month I’ve sent to &lt;a href="https://groups.google.com/forum/#!searchin/haxelang/survey/haxelang/nxPTx2xfeUA/JkUee_Z-CgAJ"&gt;the Haxe mailing list&lt;/a&gt; and &lt;a href="https://twitter.com/andy_li/status/652348811524739072"&gt;Twitter&lt;/a&gt; a short questionnaire in order to find out what operating systems our community is using or interested in using, such that I can ensure there is enough installer or package support. I’ve also added some questions on …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Last month I’ve sent to &lt;a href="https://groups.google.com/forum/#!searchin/haxelang/survey/haxelang/nxPTx2xfeUA/JkUee_Z-CgAJ"&gt;the Haxe mailing list&lt;/a&gt; and &lt;a href="https://twitter.com/andy_li/status/652348811524739072"&gt;Twitter&lt;/a&gt; a short questionnaire in order to find out what operating systems our community is using or interested in using, such that I can ensure there is enough installer or package support. I’ve also added some questions on the other aspects of how Haxe is used, e.g. is it being used in professional works, which compilation targets are being used or interested in using etc. &lt;/p&gt;
&lt;p&gt;I took this chance to have some hand-on experience with the Haxe Python target. I always wanted to use Haxe for data analysis during my PhD study. However, I’m not aware of any statistics package available to any of the Haxe targets available at that time. The Python target was released too late for my thesis. So, for my PhD, I used just vanilla Python and R, which were being used for the statistics courses I attended. Another reason to use the Haxe Python target this time is that I wanted to present this data analysis as a demo project in &lt;a href="http://2015.pycon.hk/schedule/topics/haxe-a-statically-typed-language-that-compiles-to-python-and-more/"&gt;my talk in PyCon &lt;span class="caps"&gt;HK&lt;/span&gt; 2015&lt;/a&gt;, which happened during the last weekend.&lt;/p&gt;
&lt;p&gt;I have pushed all the data together with the Haxe code I used for analysis and graph-plotting to &lt;a href="https://github.com/andyli/haxe-usage-survey"&gt;a Github repository&lt;/a&gt;. Feel free to play with it :)&lt;/p&gt;
&lt;h2&gt;Result&lt;/h2&gt;
&lt;p&gt;I’ve collected 361 entries in about 2 weeks. After removing the invalid ones (people who just don’t know or not interested in Haxe) and the duplicated ones (people clicked submit twice, resulted in having entries filled with the same email address), there are 351 valid records. It clearly shows that our Haxe community is so active and cares so much about the development of Haxe. Thank you for all the helps!&lt;/p&gt;
&lt;p&gt;The first thing I asked in the questionnaire is the experience on using Haxe, in particular is it being used for professional works. My hypothesis is that my questionnaire should reach more “serious” Haxe users and the ones who care to submit a response should also be the “serious” ones. The result meets my expectation and there are about half of the respondents using Haxe for professional works, as illustrated in the figure as follows:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Do you use Haxe?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_exp.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Having more than 160 professional Haxe users participated in this survey is pretty impressive to me.&lt;/p&gt;
&lt;p&gt;So, what is our community creating? It has been well-known that Haxe is popular among game developers. It is so popular to a point that for once &lt;a href="https://twitter.com/ncannasse/status/598041755540389888"&gt;all the top three winners of the Ludum Dare game jam were all using Haxe&lt;/a&gt;… Here the second question asks what kind of things Haxe is being used or interested in using Haxe to build:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="What are you creating, or want to use Haxe to create?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_create.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As expected, most respondents are making or interested to make games with Haxe. But other than games, there are also high interests in using Haxe for mobile/desktop applications, web sites, and even software libraries and frameworks. It suggests that Haxe is indeed a general purpose language and we cannot ignore the interests outside of game development.&lt;/p&gt;
&lt;p&gt;The next thing is to find out which compilation targets are being used or are generating interests. Historically Haxe was developed as a replacement of &lt;span class="caps"&gt;AS3&lt;/span&gt;, so I know that there were lots of people using it to create Flash contents. But given &lt;span class="caps"&gt;HTML5&lt;/span&gt; is the current hype so I suspected there is huge interest in the &lt;span class="caps"&gt;JS&lt;/span&gt; target too. The result is as follows:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Which Haxe targets are you using, or want to use / test?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_target.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As expected, the &lt;span class="caps"&gt;JS&lt;/span&gt; target is the most used / interesting target. And it is somewhat surprising to me that the number of respondents who are interested in the C++ target is nearly as high as the ones who are interested in the &lt;span class="caps"&gt;JS&lt;/span&gt; target. I believe it is due to the high performance nature of C++, making it very attractive to be used to build everything other than the web. Since you’re interested in the C++ target, I think you will be happy to know that Hugh has been actively improving it all these years and there was a &lt;a href="http://gamehaxe.com/2015/10/01/how-i-improved-hxcpp-speed-6x/"&gt;great performance improvement recently&lt;/a&gt; :)&lt;/p&gt;
&lt;p&gt;The interests in the Java, C#, and Python targets are relatively low and I personally think that they should deserve more attention from the community. It is because there exist a large amount of solid libraries in those languages. For the Java and C# targets, we don’t even have to write externs but simply add a line of &lt;code&gt;-java-lib&lt;/code&gt;/&lt;code&gt;-net-lib&lt;/code&gt; and we can make use of any Java/C# libraries. Maybe the lower interests are caused by the lack of documentation and usage example, which I hope they will be improved.&lt;/p&gt;
&lt;p&gt;Another information that can be extracted from the same question is the number of interested target per respondent. Given being multi-target as the most prominent Haxe feature, I suspect Haxe users are using or interested in more then one target. The result meets my expectation:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Number of interested targets per respondent" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_target_count_grouped.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As shown above, over 90% of the respondents are using or interested in 2 or more targets. The result is pretty much a normal distribution and the mode is 3 targets.&lt;/p&gt;
&lt;p&gt;We will then turns to analyze the development setup in the next question, which is to ask which versions of Haxe are the respondents using, or want to use / test. The result is plotted in the figure as follows:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Which version(s) of Haxe are you using, or want to use / test?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_version.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Over 90% of the respondents are using or interested in using the 3.2 series. The interests of earlier versions are much less (&amp;lt; 10% of the respondents). It is good in the way that we can mainly focus on developing the latest version without the headache of backporting bug-fixes and features to the earlier versions. &lt;/p&gt;
&lt;p&gt;Another interesting view to the data is the number of interested Haxe versions per respondent:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Number of interested Haxe versions per respondent" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_version_count_grouped.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;We can see that there is some interest in using more than one Haxe version (~20%), but the majority of respondents are interested in using only one version. That means it is not urgent to support installing multiple version of Haxe in a system, although it would be great to have a way to do so in the long run. &lt;a href="https://github.com/dpeek/hvm"&gt;&lt;span class="caps"&gt;HVM&lt;/span&gt;&lt;/a&gt; sounds promising although I haven’t tried. For testing purpose, one can easily &lt;a href="http://docs.travis-ci.com/user/languages/haxe/#Choosing-Haxe-versions-to-test-against"&gt;setup a TravisCI build matrix with multiple Haxe versions&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For the installation method, I asked how Haxe was being installed:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="How did you obtain Haxe?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_install_haxe.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As shown above, most respondents used the official installer from the haxe.org web site. There are some respondents used the third-party installer or script, which I suspect it is due to the fact that the haxe.org web site doesn’t provide a installer for Linux and people resorted to using the installer script provided by OpenFL. Given we now have Linux packages officially maintained by the Haxe Foundation, I think the OpenFL installer script can be deprecated and the usage of Linux package managers will be much higher soon. Self-remainder: I have to go to update the haxe.org download page to provide the Linux packages info.&lt;/p&gt;
&lt;p&gt;Since I want to know what Haxe installation methods have to be improved, I also asked what installation methods are being used for general development tools. Particularly, I’m a big fan of using package managers, and that’s why I’m putting effort on improving Haxe in this aspect. But does the Haxe community want to use package managers?&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Which is your preferred way to obtain development software (not necessarily Haxe)?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_install_pref.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As expected, most respondents prefer to use official installers, and they prefer package managers as well. Note that the number of respondents preferred to using package managers is higher than the number of respondents actually used package managers to install Haxe. It is because the Haxe packages were not updated until recently, so people opted to use another installation method. It means my recent effort in updating the Linux packages for the Haxe Foundation should be useful and you can start to use package managers to install Haxe as you wished now :) I’ve also considered providing a Haxe Docker image, but given the interest is extremely low so I will save my effort for other important things for now.&lt;/p&gt;
&lt;p&gt;Let’s take a look at the &lt;span class="caps"&gt;OS&lt;/span&gt; families being used for Haxe development. Note that I’m investigating the usage of developer machines, which are the ones people install Haxe and do actually coding in. I’ve included the usual 3 major desktop &lt;span class="caps"&gt;OS&lt;/span&gt; families: Windows, Mac, and Linux/&lt;span class="caps"&gt;BSD&lt;/span&gt;. Out of interest, I’ve also added “mobile OSes” as the forth &lt;span class="caps"&gt;OS&lt;/span&gt; family, because I think mobile devices are popular and there may be people who want to code on a tablet. The result is illustrated as follows:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Amount of interest in using given OS family for Haxe development" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_os.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Surprisingly, the number of respondents who stated interest in using mobile OSes for Haxe development is higher than the ones of Mac and Linux/&lt;span class="caps"&gt;BSD&lt;/span&gt;. Turn out some people &lt;a href="https://groups.google.com/d/msg/haxelang/nxPTx2xfeUA/w-uYl3zCCAAJ"&gt;reported&lt;/a&gt; they had mistaken the question as the interest of developing for, but not on, the OSes. But still, even if we assume only half of the respondents understood the question well, there is still ~30% percent of respondents interested in developing on a mobile device!&lt;/p&gt;
&lt;p&gt;The difference between Mac and Linux/&lt;span class="caps"&gt;BSD&lt;/span&gt; is also interesting. Overall, there is higher interest in Linux/&lt;span class="caps"&gt;BSD&lt;/span&gt; than Mac. But, if we only consider the respondents who use Haxe professionally (the green and dark green portions), the interest in Mac is slightly higher.&lt;/p&gt;
&lt;p&gt;We then look into the interest in using individual versions of the OSes. The results for Windows and Mac versions are plotted as follows:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Which Windows version(s) do you use, or want to use, for Haxe development?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_os_win.png"/&gt;
&lt;/span&gt;
&lt;span class="center"&gt;
&lt;img alt="Which Mac version(s) do you use, or want to use, for Haxe development?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_os_mac.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;We can observe that most respondents are interested in using the latest three versions, but not the older ones. This will be a good information to know when considering installer &lt;span class="caps"&gt;OS&lt;/span&gt; version support.&lt;/p&gt;
&lt;p&gt;For Linux/&lt;span class="caps"&gt;BSD&lt;/span&gt;, I asked for the interested distros instead of individual releases of each distro to reduce the number of options. The result is plotted as follows:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Which Linux / BSD distro(s) do you use, or want to use, for Haxe development?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_os_linux.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I know that Ubuntu is super popular. As shown in the figure, there is indeed high interest in doing Haxe development on it. My recent package updating effort already covered the two most requested ones here (&lt;a href="https://blog.onthewings.net/2015/10/05/debian_package_and_ubuntu_ppa_for_haxe/"&gt;Ubuntu and Debian&lt;/a&gt;, and in fact the &lt;span class="caps"&gt;PPA&lt;/span&gt; is also usable in Linux Mint). The distros that uses &lt;span class="caps"&gt;RPM&lt;/span&gt; are not very popular among our community, but I’ve covered &lt;a href="https://blog.onthewings.net/2015/11/01/haxe_rpm_packages_for_fedora_and_opensuse/"&gt;Fedora and openSUSE&lt;/a&gt; anyway. I wasn’t aware of the popularity of Arch Linux, so this survey is proven useful to let me know about this. I’ve been &lt;a href="https://twitter.com/jonasmalaco/status/661055960249667584"&gt;told&lt;/a&gt; that there are nice packages existed in the Arch Linux &lt;span class="caps"&gt;AUR&lt;/span&gt;, and I will check and co-maintain the packages if possible.&lt;/p&gt;
&lt;p&gt;Finally we come to the result of mobile &lt;span class="caps"&gt;OS&lt;/span&gt; versions:&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Which mobile OS(es) do you use, or want to use, for Haxe development?" src="https://raw.githubusercontent.com/andyli/haxe-usage-survey/master/out/fig_os_mobile.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As previously mentioned, since there were respondents mistaken this question, it is safer to consider this result as the general interest but not development specific. If we take a look at the &lt;a href="https://en.wikipedia.org/wiki/Mobile_operating_system#Market_share"&gt;world-wide market share of the mobile OSes&lt;/a&gt;, we can observe that the two rankings are basically the same.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;The survey result serves my purpose well. It verified the usefulness of maintaining the Haxe packages across different OSes. It also gives nice information for prioritizing improvements to the supports of different OSes, Haxe versions, targets, and application domains.&lt;/p&gt;
&lt;p&gt;I think it would be nice to have this kind of survey once for every few months, to understand how our community is evolving and to dig out more interesting information.&lt;/p&gt;</content><category term="Haxe"></category><category term="data analysis"></category></entry><entry><title>Haxe RPM Packages for Fedora and openSUSE</title><link href="https://blog.onthewings.net/2015/11/01/haxe_rpm_packages_for_fedora_and_opensuse/" rel="alternate"></link><published>2015-11-01T00:00:00+08:00</published><updated>2015-11-01T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2015-11-01:/2015/11/01/haxe_rpm_packages_for_fedora_and_opensuse/</id><summary type="html">&lt;p&gt;After &lt;a href="https://blog.onthewings.net/2015/10/05/debian_package_and_ubuntu_ppa_for_haxe/"&gt;polishing the Debian/Ubuntu .deb packages&lt;/a&gt;, I’m now bringing Haxe to &lt;a href="https://getfedora.org/"&gt;Fedora&lt;/a&gt; and &lt;a href="https://www.opensuse.org/"&gt;openSUSE&lt;/a&gt;, which are very popular Linux distros that use the .rpm package format.&lt;/p&gt;
&lt;h2&gt;Haxe arrived in Fedora 23 and Fedora Rawhide&lt;/h2&gt;
&lt;p&gt;There was an effort on bringing Haxe to Fedora back in 2008. Richard &lt;span class="caps"&gt;W …&lt;/span&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;After &lt;a href="https://blog.onthewings.net/2015/10/05/debian_package_and_ubuntu_ppa_for_haxe/"&gt;polishing the Debian/Ubuntu .deb packages&lt;/a&gt;, I’m now bringing Haxe to &lt;a href="https://getfedora.org/"&gt;Fedora&lt;/a&gt; and &lt;a href="https://www.opensuse.org/"&gt;openSUSE&lt;/a&gt;, which are very popular Linux distros that use the .rpm package format.&lt;/p&gt;
&lt;h2&gt;Haxe arrived in Fedora 23 and Fedora Rawhide&lt;/h2&gt;
&lt;p&gt;There was an effort on bringing Haxe to Fedora back in 2008. Richard &lt;span class="caps"&gt;W.M.&lt;/span&gt; Jones, &lt;a href="https://rwmj.wordpress.com/about/"&gt;who is an employee of Red Hat&lt;/a&gt;, packaged &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=460779"&gt;Neko 1.7.1&lt;/a&gt; and &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=460780"&gt;Haxe 2.0&lt;/a&gt;. However, only Neko was accepted. There was somehow nobody to review the Haxe package and it was abandoned years after it was submitted. The good thing is that the Neko package is properly maintained since then and Neko 2.0.0 is already available since 2013 (Thanks Richard!).&lt;/p&gt;
&lt;p&gt;Went through the weeks-long &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=1270554"&gt;submission review process&lt;/a&gt;, I am happy to announce that Haxe 3.2.1 is now accepted and available in Fedora 23, which will be released on the coming Tuesday (2015-11-03), and &lt;a href="https://fedoraproject.org/wiki/Releases/Rawhide"&gt;Fedora Rawhide&lt;/a&gt;, which is the current development version of Fedora. Install Haxe on Fedora is now as simple as &lt;code&gt;sudo dnf install haxe&lt;/code&gt; (as usual, Neko as a dependency will be installed too).&lt;/p&gt;
&lt;p&gt;I’m trying to submit Haxe to Fedora 22 too. A re-build of Neko is needed and it is &lt;a href="https://bodhi.fedoraproject.org/updates/FEDORA-2015-4fcff24184"&gt;going through the update procedure&lt;/a&gt;. Once the Neko update is available in Fedora 22, I will build and submit Haxe. You may check &lt;a href="https://bodhi.fedoraproject.org/users/andyli"&gt;this page&lt;/a&gt; to follow the ongoing update activities.&lt;/p&gt;
&lt;h2&gt;Submitting Haxe to openSUSE&lt;/h2&gt;
&lt;p&gt;For openSUSE, again there are nice people built a Haxe package. The status is pretty good: there are &lt;a href="https://build.opensuse.org/package/show/games/nekovm"&gt;Neko 2.0.0&lt;/a&gt; and &lt;a href="https://build.opensuse.org/package/show/games/haxe"&gt;Haxe 3.2.0&lt;/a&gt; in the Games Project in the openSUSE Build Service. However, they are not part of the official releases of openSUSE in the sense that users have to use &lt;code&gt;zypper addrepo ...&lt;/code&gt; before &lt;code&gt;zypper install haxe&lt;/code&gt;. It is kind of like using a &lt;span class="caps"&gt;PPA&lt;/span&gt; in Ubuntu. And Haxe definitely deserves its own project outside Games, since we have a lot of Haxe users building all kinds of good stuffs other than making games.&lt;/p&gt;
&lt;p&gt;I’ve created a new project in the openSUSE Build Service, &lt;a href="https://build.opensuse.org/project/show/devel:languages:haxe"&gt;devel:languages:haxe&lt;/a&gt;, to provide dedicated maintenance. I’ve already built Neko 2.0.0 and Haxe 3.2.1 there, and they can be installed to openSUSE 13.1, 13.2, Leap 42.1, and Tumbleweed. I’m still working on the submission to openSUSE Factory (the repository of their releases), but you can already install the packages by following the instructions in the &lt;a href="https://build.opensuse.org/package/show/devel:languages:haxe/haxe"&gt;haxe package page&lt;/a&gt; (click “Download package” at the top right corner).&lt;/p&gt;
&lt;h2&gt;What’s next?&lt;/h2&gt;
&lt;p&gt;Probably &lt;a href="https://www.archlinux.org/"&gt;Arch Linux&lt;/a&gt; will be the next (and the last one in my current plan) Linux distro to receive official Haxe package. In fact, there are more Haxe users interested in using Arch Linux than Fedora and openSUSE combined, according to the Haxe usage survey I conducted recently. And talking about the survey, I’m working hard on polishing the data and plotting graphs using the Haxe Python target. The result will be published in this blog in the coming week, and I will present the analysis procedure as an example of using the Python target in &lt;a href="http://2015.pycon.hk/schedule/topics/haxe-a-statically-typed-language-that-compiles-to-python-and-more/"&gt;my talk in PyCon Hong Kong&lt;/a&gt;.&lt;/p&gt;</content><category term="Haxe"></category><category term="Fedora"></category><category term="openSUSE"></category></entry><entry><title>Upcoming Haxe Talks: London JavaScript Community Online Meetup and PyCon HK 2015</title><link href="https://blog.onthewings.net/2015/10/10/upcoming_haxe_talks_LondonJavaScriptCommunity_PyConHK/" rel="alternate"></link><published>2015-10-10T00:00:00+08:00</published><updated>2015-10-10T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2015-10-10:/2015/10/10/upcoming_haxe_talks_LondonJavaScriptCommunity_PyConHK/</id><summary type="html">&lt;p&gt;This is a busy speaking year for me :) I have presented &lt;a href="http://www.silexlabs.org/continuous-integration-for-haxe-projects/"&gt;&lt;span class="caps"&gt;CI&lt;/span&gt; for Haxe projects in &lt;span class="caps"&gt;WWX&lt;/span&gt; 2015&lt;/a&gt;, and then a &lt;a href="http://2015.opensource.hk/agenda/topic/transcompiling-towards-the-freedom-of-programming-language-and-platform-choice/"&gt;HKOSCon 2015 talk on Haxe as a transcompilation technology&lt;/a&gt;. I will deliver another 2 talks in this and the follow month.&lt;/p&gt;
&lt;h2&gt;London JavaScript Community Online Meetup&lt;/h2&gt;
&lt;p&gt;I’m so …&lt;/p&gt;</summary><content type="html">&lt;p&gt;This is a busy speaking year for me :) I have presented &lt;a href="http://www.silexlabs.org/continuous-integration-for-haxe-projects/"&gt;&lt;span class="caps"&gt;CI&lt;/span&gt; for Haxe projects in &lt;span class="caps"&gt;WWX&lt;/span&gt; 2015&lt;/a&gt;, and then a &lt;a href="http://2015.opensource.hk/agenda/topic/transcompiling-towards-the-freedom-of-programming-language-and-platform-choice/"&gt;HKOSCon 2015 talk on Haxe as a transcompilation technology&lt;/a&gt;. I will deliver another 2 talks in this and the follow month.&lt;/p&gt;
&lt;h2&gt;London JavaScript Community Online Meetup&lt;/h2&gt;
&lt;p&gt;I’m so glad to be invited by the &lt;a href="http://www.meetup.com/London-JavaScript-Community/"&gt;London JavaScript Community&lt;/a&gt; to deliver a talk via video stream next week. It will be an online meetup, which means everyone will be free to join without geographic constraint. My talk will target people who are interested in web development, particularly in front-end, JavaScript-related technologies. I will introduce Haxe with a focus in its &lt;span class="caps"&gt;JS&lt;/span&gt; target.&lt;/p&gt;
&lt;p&gt;The talk will be hosted on 15th October (Thursday) at 12:30pm &lt;span class="caps"&gt;UK&lt;/span&gt; time (&lt;a href="http://www.wolframalpha.com/input/?i=15th+October+12%3A30pm+UK+time+to+local+time"&gt;convert to your timezone here&lt;/a&gt;). Sign up in the &lt;a href="http://www.meetup.com/London-JavaScript-Community/events/224686660/"&gt;online meetup event page&lt;/a&gt; if you’re interested. Don’t forget to invite your friends too ;)&lt;/p&gt;
&lt;h2&gt;PyCon &lt;span class="caps"&gt;HK&lt;/span&gt; 2015&lt;/h2&gt;
&lt;p&gt;I’m also glad to announce that my talk proposal has been accepted by &lt;a href="http://2015.pycon.hk/"&gt;PyCon &lt;span class="caps"&gt;HK&lt;/span&gt; 2015&lt;/a&gt;, which is the first PyCon in Hong Kong. My Haxe talk will also be introductory, but obviously will shift the focus to the Haxe Python target. I will demonstrate how to interop between Haxe and Python, to utilize the rich and solid scientific Python libraries in the modern, statically-typed Haxe language, using some simple examples of data analysis and visualization.&lt;/p&gt;
&lt;p&gt;PyCon &lt;span class="caps"&gt;HK&lt;/span&gt; 2015 will be held on 7-8 November 2015 (Saturday-Sunday) in Hong Kong Cyberport. My talk will be on day two, 15:40 - 16:20 (&lt;a href="http://2015.pycon.hk/schedule/"&gt;schedule&lt;/a&gt;). &lt;a href="https://www.eventbrite.com/e/pycon-hong-kong-2015-tickets-15794599071"&gt;Buy a ticket&lt;/a&gt; if you’re interested to attend.&lt;/p&gt;</content><category term="Haxe"></category><category term="JS"></category><category term="Python"></category><category term="talk"></category></entry><entry><title>Debian Package and Ubuntu PPA for Haxe</title><link href="https://blog.onthewings.net/2015/10/05/debian_package_and_ubuntu_ppa_for_haxe/" rel="alternate"></link><published>2015-10-05T00:00:00+08:00</published><updated>2015-10-05T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2015-10-05:/2015/10/05/debian_package_and_ubuntu_ppa_for_haxe/</id><summary type="html">&lt;p&gt;Since the previous month I’ve been working on Haxe to bring better supports for Debian/Ubuntu. There are still some tasks I would like to work on, but there are already some good stuffs that I want to let you know.&lt;/p&gt;
&lt;h2&gt;About Debian and Ubuntu&lt;/h2&gt;
&lt;p&gt;For people who don …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Since the previous month I’ve been working on Haxe to bring better supports for Debian/Ubuntu. There are still some tasks I would like to work on, but there are already some good stuffs that I want to let you know.&lt;/p&gt;
&lt;h2&gt;About Debian and Ubuntu&lt;/h2&gt;
&lt;p&gt;For people who don’t familiar with the Linux world, let me quickly introduce what are Debian and Ubuntu.&lt;/p&gt;
&lt;p&gt;Due to the free and open source (&lt;span class="caps"&gt;FOSS&lt;/span&gt;) nature of Linux, there exist a lot of different versions (known as distributions) of Linux, created by different people with different goals. &lt;a href="https://www.debian.org/"&gt;Debian&lt;/a&gt; is one of the earliest and largest (most packages available) distributions. One of the most well-known distributions based on Debian is &lt;a href="http://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt;, which also has a lot of downstream projects based on it, e.g. &lt;a href="http://linuxmint.com/"&gt;Linux Mint&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Both Debian and Ubuntu, together with most of the distributions that based on them, use the .deb file format for packaging software. The Debian project maintains a set of package repositories, which are also used by Ubuntu. Only the approved members can upload packages to those repositories. People who are not Debian developers/maintainers, but want to add or update a Debian package have to file a packaging request, or to go through its &lt;a href="http://mentors.debian.net/"&gt;sponsorship/mentoring&lt;/a&gt; process. The concept is similar to git, in which a project owner merge pull requests to accept contribution.&lt;/p&gt;
&lt;h2&gt;Updating the Debian Haxe package&lt;/h2&gt;
&lt;p&gt;Long time ago there are some volunteers who packaged Haxe and Neko and had them uploaded to Debian. But sadly they have moved on and orphaned the packages. The Haxe package stayed in Haxe version 3.0.0, for 2 years since 2013. The Neko package was built with Neko 2.0.0, which is the latest stable release. However, there was a critical bug related to &lt;span class="caps"&gt;JIT&lt;/span&gt; in the Neko package, leading to &lt;a href="https://bugs.launchpad.net/ubuntu/+source/haxe/+bug/1251221"&gt;haxelib being unusable in the 32 bit platforms&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Instead of waiting for another volunteer to update the package for us, I stepped in on behalf of the Haxe Foundation and have taken over the maintenance of the packages by going through its sponsorship/mentoring process. It was not trivial since I didn’t have much knowledge on Debian packaging, but eventually I’ve updated the Haxe package to provide Haxe 3.2.0, and the Neko package to include the &lt;span class="caps"&gt;JIT&lt;/span&gt; bug fix.&lt;/p&gt;
&lt;p&gt;Debian packages being accepted will be available in the unstable repo at first. If there is no bug being reported in 10 days, the packages will be automatically synced to the testing repo, in which the next stable release of Debian will be based on. Our updated Haxe package &lt;a href="https://packages.debian.org/stretch/haxe"&gt;has already been synced to testing&lt;/a&gt;. The updated Neko package &lt;a href="https://packages.debian.org/sid/neko"&gt;is still in unstable only&lt;/a&gt;, and will be synced to testing in 2 days.&lt;/p&gt;
&lt;p&gt;If you have a Debian stable release installed, and want to try out the updated Haxe and Neko packages in the testing/unstable repo, consult the &lt;a href="https://wiki.debian.org/AptPreferences"&gt;&lt;span class="caps"&gt;APT&lt;/span&gt; Preferences article&lt;/a&gt;. If you’re using Ubuntu, we have an easier option for you: Personal Package Archives (&lt;span class="caps"&gt;PPA&lt;/span&gt;).&lt;/p&gt;
&lt;h2&gt;Ubuntu &lt;span class="caps"&gt;PPA&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://help.launchpad.net/Packaging/PPA"&gt;Personal Package Archives&lt;/a&gt; (&lt;span class="caps"&gt;PPA&lt;/span&gt;) as its name suggests, is a personal (third party) repository. Once a &lt;span class="caps"&gt;PPA&lt;/span&gt; is added to a system, the system can obtain software packages provided by the &lt;span class="caps"&gt;PPA&lt;/span&gt; via the standard apt-get command. Compared to the configuration required to get packages from Debian testing/unstable, using a &lt;span class="caps"&gt;PPA&lt;/span&gt; is much easier.&lt;/p&gt;
&lt;p&gt;I’ve created an official &lt;a href="https://launchpad.net/~haxe/"&gt;launchpad account for the Haxe Foundation&lt;/a&gt;. In its &lt;a href="https://launchpad.net/~haxe/+archive/ubuntu/releases"&gt;stable releases&lt;/a&gt; repository, the latest versions of Haxe and Neko are provided to all the currently supported Ubuntu versions, which includes Ubuntu 12.04, 14.04, and 15.04. It also provides packages for the upcoming Ubuntu 15.10, which is scheduled to be released on 22nd Oct.&lt;/p&gt;
&lt;p&gt;To use the &lt;span class="caps"&gt;PPA&lt;/span&gt;, run the commands as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;sudo add-apt-repository ppa:haxe/releases -y
sudo apt-get update
sudo apt-get install haxe -y
mkdir ~/haxelib &amp;amp;&amp;amp; haxelib setup ~/haxelib
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;-y&lt;/code&gt; options above suppress confirmation messages.&lt;/p&gt;
&lt;p&gt;I’ve mentioned another &lt;a href="https://launchpad.net/~eyecreate/+archive/ubuntu/haxe"&gt;&lt;span class="caps"&gt;PPA&lt;/span&gt; provided by eyecreate&lt;/a&gt; the first time &lt;a href="http://blog.onthewings.net/2013/03/19/automated-unit-testing-for-haxe-project-using-travis-ci/"&gt;I wrote about TravisCI&lt;/a&gt;. It was the best &lt;span class="caps"&gt;PPA&lt;/span&gt; available to obtain Haxe on Ubuntu, and he quickly updated the package every time we had a new Haxe release (Thanks!). However, if you’re using eyecreate’s &lt;span class="caps"&gt;PPA&lt;/span&gt;, I would recommend switching to the Haxe Foundation’s. It is because our packages are built as similar to the Debian ones as possible, such that it is easy to switch to use the Debian/Ubuntu ones when they’re provided by the next stable releases of Debian/Ubuntu. Moreover, security-wise, it is always safer to use the “official” PPAs for any software.&lt;/p&gt;
&lt;h2&gt;What’s next?&lt;/h2&gt;
&lt;p&gt;With the updated Debian package and official Haxe Foundation &lt;span class="caps"&gt;PPA&lt;/span&gt;, it is much easer for the Debian/Ubuntu guys to use Haxe. I will continue to package Haxe for other OSes, e.g. &lt;a href="https://getfedora.org/"&gt;Fedora&lt;/a&gt;, which uses the .rpm format instead of the Debian .deb format. I also plan to add another &lt;span class="caps"&gt;PPA&lt;/span&gt; to provide automated snapshot builds of the Haxe development branch, which will let us test with the latest commits much easier.&lt;/p&gt;</content><category term="Haxe"></category><category term="Debian"></category><category term="Ubuntu"></category></entry><entry><title>Continuous Improvement on Continuous Integration for Haxe Projects</title><link href="https://blog.onthewings.net/2015/09/02/continuous_improvement_on_continuous_integration_for_haxe_projects/" rel="alternate"></link><published>2015-09-02T00:00:00+08:00</published><updated>2015-09-02T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2015-09-02:/2015/09/02/continuous_improvement_on_continuous_integration_for_haxe_projects/</id><summary type="html">&lt;p&gt;Things have been moving fast! Since I have written about Travis &lt;span class="caps"&gt;CI&lt;/span&gt; the first time &lt;a href="https://blog.onthewings.net/2013/03/19/automated-unit-testing-for-haxe-project-using-travis-ci/"&gt;around 2 years ago&lt;/a&gt;, there are many news and improvements regarding to using &lt;span class="caps"&gt;CI&lt;/span&gt; services for Haxe projects.&lt;/p&gt;
&lt;h2&gt;&lt;span class="caps"&gt;WWX&lt;/span&gt; 2015 presentation&lt;/h2&gt;
&lt;p&gt;The video of my &lt;span class="caps"&gt;WWX&lt;/span&gt; 2015 talk, &lt;a href="http://www.silexlabs.org/continuous-integration-for-haxe-projects/"&gt;“Continuous Integration for Haxe Projects”&lt;/a&gt;, was released …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Things have been moving fast! Since I have written about Travis &lt;span class="caps"&gt;CI&lt;/span&gt; the first time &lt;a href="https://blog.onthewings.net/2013/03/19/automated-unit-testing-for-haxe-project-using-travis-ci/"&gt;around 2 years ago&lt;/a&gt;, there are many news and improvements regarding to using &lt;span class="caps"&gt;CI&lt;/span&gt; services for Haxe projects.&lt;/p&gt;
&lt;h2&gt;&lt;span class="caps"&gt;WWX&lt;/span&gt; 2015 presentation&lt;/h2&gt;
&lt;p&gt;The video of my &lt;span class="caps"&gt;WWX&lt;/span&gt; 2015 talk, &lt;a href="http://www.silexlabs.org/continuous-integration-for-haxe-projects/"&gt;“Continuous Integration for Haxe Projects”&lt;/a&gt;, was released a few days ago. The key idea of my talk is that, &lt;span class="caps"&gt;CI&lt;/span&gt; is surprisingly easy to set up. We don’t even have to write tests - we can simply let the build service compile our code, and the mighty Haxe compiler is already able to catch all kinds of errors for us. I’ve also demonstrated how to set up Travis &lt;span class="caps"&gt;CI&lt;/span&gt; and AppVeyor for a hello world project. Additional links and details can be found in &lt;a href="https://docs.google.com/presentation/d/1AcqUbB_Zn5dQyxpv9BYokOXMPuEcYEXMA7w6E50kpNo/edit?usp=sharing"&gt;the slides&lt;/a&gt;.&lt;/p&gt;
&lt;style&gt;
.wrapper_16-9 {
    position: relative;
    padding-bottom: 56.25%;
    padding-top: 25px;
    height: 0;
}
.wrapper_16-9 iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
&lt;/style&gt;
&lt;div class="wrapper_16-9"&gt;
&lt;iframe allowfullscreen="" frameborder="0" height="480" src="https://www.youtube.com/embed/ZYMyvkrownQ" style="width:" width="854"&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;h2&gt;Built-in Haxe support in Travis &lt;span class="caps"&gt;CI&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;As mentioned in my talk, earlier this year we’ve contributed &lt;a href="http://blog.travis-ci.com/2015-04-07-haxe-now-available-on-travis-ci/"&gt;Haxe support in Travis &lt;span class="caps"&gt;CI&lt;/span&gt;&lt;/a&gt; as one of its “community-supported languages”. Since then using Haxe in Travis &lt;span class="caps"&gt;CI&lt;/span&gt; is easier than ever. No need to figure out how to use a &lt;span class="caps"&gt;PPA&lt;/span&gt; or to use a install script. Just specify in &lt;code&gt;.travis.yml&lt;/code&gt; that we want to use Haxe and optionally what version(s) we what to use as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;language&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;haxe&lt;/span&gt;
&lt;span class="n"&gt;haxe&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
  &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"3.2.0"&lt;/span&gt;
  &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;development&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;Multi-&lt;span class="caps"&gt;OS&lt;/span&gt; testing&lt;/h2&gt;
&lt;p&gt;Previously &lt;a href="http://docs.travis-ci.com/user/multi-os/"&gt;Travis &lt;span class="caps"&gt;CI&lt;/span&gt;’s multi-&lt;span class="caps"&gt;OS&lt;/span&gt; feature&lt;/a&gt; is limited to selected repositories. One has to ask their staff to manually turn it on for specific Github repositories. Earlier this week, Travis &lt;span class="caps"&gt;CI&lt;/span&gt; made their multi-&lt;span class="caps"&gt;OS&lt;/span&gt; feature publicly available. It means that we can now test on both Linux (Ubuntu) and Mac &lt;span class="caps"&gt;OSX&lt;/span&gt; by adding an &lt;code&gt;os&lt;/code&gt; section in &lt;code&gt;.travis.yml&lt;/code&gt; as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;os:
  - linux
  - osx
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Windows testing can be done on &lt;a href="http://www.appveyor.com/"&gt;AppVeyor&lt;/a&gt;. Although Haxe is not pre-installed in AppVeyor’s environment, and there is no such concept of “supported languages”, we can still &lt;a href="https://blog.onthewings.net/2015/01/28/installing-haxe-on-windows-using-chocolatey/"&gt;install Haxe easily using Chocolatey&lt;/a&gt; in the &lt;code&gt;install&lt;/code&gt; section of &lt;code&gt;appveyor.yml&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;install:
  - cinst haxe -version 3.2.0 -y
  - RefreshEnv
  - mkdir C:\projects\haxelib
  - haxelib setup C:\projects\haxelib
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By the way, AppVeyor has also rolled out &lt;a href="http://www.appveyor.com/blog/2015/06/23/new-oss-build-environment-and-xamarin-support"&gt;a faster build environment&lt;/a&gt;, which is used by default for new free &lt;span class="caps"&gt;OSS&lt;/span&gt; accounts. The old environment was super slow that it was a pain to build hxcpp projects in it. With the new environment, building on AppVeyor is now as fast as using local machine or using Travis &lt;span class="caps"&gt;CI&lt;/span&gt;.&lt;/p&gt;
&lt;h2&gt;More docs and samples&lt;/h2&gt;
&lt;p&gt;I’ve created a Github repository, &lt;a href="https://github.com/andyli/HaxeCI"&gt;HaxeCI&lt;/a&gt;, as an example of using &lt;span class="caps"&gt;CI&lt;/span&gt; for a Haxe project. As of writing, it contains configurations for Travis &lt;span class="caps"&gt;CI&lt;/span&gt; and AppVeyor. It also demonstrates how to build and run for each of the Haxe targets in the &lt;span class="caps"&gt;CI&lt;/span&gt; environments. (Thank &lt;a href="https://github.com/ciscoheat"&gt;Andreas&lt;/a&gt; for the contributions regarding to the PhantomJS and Flash testing!)&lt;/p&gt;
&lt;p&gt;If you haven’t started using &lt;span class="caps"&gt;CI&lt;/span&gt;, &lt;span class="caps"&gt;NOW&lt;/span&gt; is the best time to check it out!&lt;/p&gt;</content><category term="Haxe"></category><category term="CI"></category></entry><entry><title>TypeScript vs Haxe, Which is the Better Compile-to-JS Language?</title><link href="https://blog.onthewings.net/2015/08/05/typescript-vs-haxe/" rel="alternate"></link><published>2015-08-05T00:00:00+08:00</published><updated>2015-08-05T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2015-08-05:/2015/08/05/typescript-vs-haxe/</id><summary type="html">&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="TypeScript vs Haxe" src="https://blog.onthewings.net/files/2015/ts-vs-haxe.svg"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Microsoft/TypeScript"&gt;TypeScript&lt;/a&gt; is definitely one of the most well-known compile-to-&lt;span class="caps"&gt;JS&lt;/span&gt; languages nowadays. Designed as a superset of JavaScript, TypeScript brings in static-typing for writing large-scale application. &lt;a href="http://haxe.org/"&gt;Haxe&lt;/a&gt; is similar to TypeScript in many aspects, particularly its &lt;span class="caps"&gt;JS&lt;/span&gt;-like syntax, static-typing, and module system. Among &lt;a href="http://haxe.org/documentation/introduction/compiler-targets.html"&gt;the 9 Haxe compilation targets&lt;/a&gt;, the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="TypeScript vs Haxe" src="https://blog.onthewings.net/files/2015/ts-vs-haxe.svg"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/Microsoft/TypeScript"&gt;TypeScript&lt;/a&gt; is definitely one of the most well-known compile-to-&lt;span class="caps"&gt;JS&lt;/span&gt; languages nowadays. Designed as a superset of JavaScript, TypeScript brings in static-typing for writing large-scale application. &lt;a href="http://haxe.org/"&gt;Haxe&lt;/a&gt; is similar to TypeScript in many aspects, particularly its &lt;span class="caps"&gt;JS&lt;/span&gt;-like syntax, static-typing, and module system. Among &lt;a href="http://haxe.org/documentation/introduction/compiler-targets.html"&gt;the 9 Haxe compilation targets&lt;/a&gt;, the &lt;span class="caps"&gt;JS&lt;/span&gt; target was one of the oldest ones. It was introduced &lt;a href="https://github.com/HaxeFoundation/haxe/blob/3.2.0/extra/CHANGES.txt#L1496-L1497"&gt;in March 2006&lt;/a&gt;, which was way before Microsoft released TypeScript &lt;a href="https://en.wikipedia.org/wiki/TypeScript#History"&gt;in 2012&lt;/a&gt;. In fact, Haxe is a language that compiles to &lt;span class="caps"&gt;JS&lt;/span&gt;, ahead of everyone else including TypeScript (2012), &lt;a href="http://coffeescript.org/"&gt;CoffeeScript&lt;/a&gt; (2009), &lt;a href="https://www.dartlang.org/"&gt;Dart&lt;/a&gt; (2011), and Java via &lt;a href="http://www.gwtproject.org/"&gt;&lt;span class="caps"&gt;GWT&lt;/span&gt;&lt;/a&gt; (May 2006). So I wonder, which is the better compile-to-&lt;span class="caps"&gt;JS&lt;/span&gt; language, the (relatively) new shiny TypeScript, or the good-old mature Haxe?&lt;/p&gt;
&lt;p&gt;I have been using Haxe for years and I’m now a member of the Haxe Foundation, contributing to Haxe daily. So I can be considered as a Haxe expert. But I didn’t have much knowledge of TypeScript other than watched some presentations about it and read some docs on its website. To gain enough knowledge and experience of it to make the comparison as fair as possible, I took a &lt;span class="caps"&gt;MOOC&lt;/span&gt; course from edX, &lt;a href="https://www.edx.org/course/introduction-typescript-microsoft-dev201x-0"&gt;Introduction to TypeScript&lt;/a&gt;, and completed it. I went through the &lt;a href="http://www.typescriptlang.org/Handbook"&gt;TypeScript handbook&lt;/a&gt; and most of the &lt;a href="https://github.com/Microsoft/TypeScript/wiki"&gt;Github wiki pages&lt;/a&gt;. But nevertheless, I’m merely acknowledgeable. If there is any TypeScript experts reading this, feel free to point out my errors via commenting.&lt;/p&gt;
&lt;p&gt;In this blog post, we compare the language designs of TypeScript and Haxe in a few areas in different levels. On the surface, we look at the two syntaxes, then discuss the underlying differences in semantics. The analysis follows by digging into the type systems and the way the two languages organize and generate code. Note that we compare only the major differences in &lt;strong&gt;language design&lt;/strong&gt; - the comparison is not exhaustive. Particularly this post is missing in-depth discussion on tools (e.g. &lt;span class="caps"&gt;IDE&lt;/span&gt;), third party libraries, and communities.&lt;/p&gt;
&lt;h2&gt;Fight!&lt;/h2&gt;
&lt;h3&gt;Syntax&lt;/h3&gt;
&lt;p&gt;TypeScript is designed as a superset of &lt;span class="caps"&gt;JS&lt;/span&gt;. That means, any valid &lt;span class="caps"&gt;JS&lt;/span&gt; code is also valid TypeScript code. This makes porting code between TypeScript and &lt;span class="caps"&gt;JS&lt;/span&gt; very easy, since they share exactly the same basic syntax constructs.&lt;/p&gt;
&lt;p&gt;Haxe syntax is also very &lt;span class="caps"&gt;JS&lt;/span&gt;-like. But it is more technically correct to say that it is ECMAScript-like, or similar to ActionScript, since Haxe was historically built as an alternative to ActionScript for authoring Flash swf contents. Anyway, the basic syntax constructs are mostly equals to &lt;span class="caps"&gt;JS&lt;/span&gt;’s. One exception is the missing of classic C-style for-loop, i.e. &lt;code&gt;for (int i = 0 ; i &amp;lt; 10; i++) {}&lt;/code&gt;, which is replaced by &lt;a href="http://haxe.org/manual/expression-for.html"&gt;&lt;code&gt;Iterator&lt;/code&gt; based for-loop&lt;/a&gt;, i.e. &lt;code&gt;for (i in 0...10) {}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;On top of the &lt;span class="caps"&gt;JS&lt;/span&gt; syntax, TypeScript adds the ability to annotate types to variable, in the form of &lt;code&gt;var str:string;&lt;/code&gt;. Haxe shares the same syntax, except all the types are first-letter upper-cased, i.e. &lt;code&gt;var str:String;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;TypeScript has two way to write an Array type. Haxe only has one.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;list&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;list&lt;/span&gt;:&lt;span class="kt"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; list&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"a"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"b"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Although TypeScript and Haxe basic syntaxes look pretty much the same, but Haxe embodied a powerful functional programming concept that TypeScript/&lt;span class="caps"&gt;JS&lt;/span&gt; doesn’t - the Haxe syntax is &lt;a href="https://en.wikipedia.org/wiki/Expression-oriented_programming_language"&gt;expression-oriented&lt;/a&gt;, which means &lt;a href="https://blog.onthewings.net/2012/10/14/haxe-tips-everything-is-an-expression/"&gt;most of the constructs are expressions&lt;/a&gt; that can be evaluated to values. For things that we have to use a block (&lt;code&gt;{}&lt;/code&gt;) in TypeScript/&lt;span class="caps"&gt;JS&lt;/span&gt;, we can use any expression in Haxe:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;

&lt;span class="c1"&gt;// function definition is an expression that&lt;/span&gt;
&lt;span class="c1"&gt;// the function body can be any expression, not necessarily {}&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// loops, including for-loops, are expressions that&lt;/span&gt;
&lt;span class="c1"&gt;// the loop body can be any expression, not necessarily {}&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"i is "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// if-else is also an expression that takes expressions&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;isCool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"yay!"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"nay..."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// you should have noticed all the above are expressions that takes expressions&lt;/span&gt;
&lt;span class="c1"&gt;// that means we can treat everything like puzzle pieces&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;checkEvenOdd&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ints&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;ints&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;" is even!"&lt;/span&gt;
            &lt;span class="k"&gt;else&lt;/span&gt;
                &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;" is odd!"&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Blocks are useless now?&lt;/span&gt;
&lt;span class="c1"&gt;// Nop, a block is a powerful expression too!&lt;/span&gt;
&lt;span class="c1"&gt;// It is evaluated as the last expression inside it.&lt;/span&gt;
&lt;span class="c1"&gt;// Here is an example that use try-catch expression together with block expressions.&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; result &lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; a &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;computationThatMayThrow&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;finalComputation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Dynamic&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;rollBack&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;defaultValue&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Yo dawg! I heard u like expressions! So we let you put expressions inside expressions!" src="https://blog.onthewings.net/files/2015/nested-expression-meme.jpg"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The rule of semicolons is another thing that the Haxe syntax is better than the TypeScript one. TypeScript features automatic semicolon insertion, which means semicolon is optional in a lot of cases. Douglas Crockford &lt;a href="http://www.crockford.com/javascript/javascript.html"&gt;wrote it clearly&lt;/a&gt;, “semicolon insertion was a huge mistake”. Semicolons in Haxe is not optional, making it impossible to make mistake as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt;
    &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;// undefined, why?&lt;/span&gt;

&lt;span class="c1"&gt;// the equivalent semicolon-inserted version:&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; add &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; a &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; b &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt;
        &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt; &lt;span class="c1"&gt;// 3&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;TypeScript and Haxe have similar syntaxes for functions, but there are some minor differences regarding to parameters. E.g. for optional parameter, notice the placement of &lt;code&gt;?&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name?&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Hello, "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Hello"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(?&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// no implicit conversion to Bool&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Hello, "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"Hello"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Rest parameter:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;buildName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;firstName&lt;/span&gt;: &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;restOfName&lt;/span&gt;: &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[])&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;firstName&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s2"&gt;" "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;restOfName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;" "&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe does not allow writing function of variable-lengthed parameters.&lt;/span&gt;
&lt;span class="c1"&gt;// But it let us declare such functions when &lt;/span&gt;
&lt;span class="c1"&gt;// writing extern using the special `haxe.extern.Rest` type.&lt;/span&gt;
&lt;span class="kd"&gt;extern&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Namebuilder&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rest&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;haxe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;extern&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Rest&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;):&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Another function syntax difference is that TypeScript supports the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions"&gt;&lt;span class="caps"&gt;ES6&lt;/span&gt; fat-arrow function&lt;/a&gt;. Haxe does not has any equivalent short-handed syntax for functions. &lt;a href="https://github.com/ncannasse"&gt;Nicolas Cannasse&lt;/a&gt;, the creator of Haxe, &lt;a href="https://medium.com/@ncannasse/haxe-and-short-lambdas-c1f360f7c7c"&gt;refuses to add such syntax&lt;/a&gt;, despite of being popularly requested. One major reason is that the Haxe function definition syntax is already pretty compact due to its expression-oriented nature. Moreover, with the help of &lt;a href="http://haxe.org/manual/macro.html"&gt;macros&lt;/a&gt;, Haxe libraries (e.g. &lt;a href="https://github.com/haxetink/tink_lang#short-lambdas"&gt;tink_lang&lt;/a&gt; and &lt;a href="https://github.com/ciscoheat/slambda"&gt;Slambda&lt;/a&gt;) can implement syntaxes similar to, or even shorter than the TypeScript/&lt;span class="caps"&gt;ES6&lt;/span&gt; one.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;evens&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;

&lt;span class="c1"&gt;// built-in anonymous function definition syntax&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; evens &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// tink_lang&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; evens &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Slambda&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; evens &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;TypeScript and Haxe also differ in writing the types of function. The one in TypeScript is easy to understand, because it looks very similar to the arrow function notation:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;:&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;:&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The Haxe one is unfortunately kind of a “wrong” choice, since it suggests there is &lt;a href="https://en.wikipedia.org/wiki/Currying"&gt;auto currying or auto partial application&lt;/a&gt;, which is not supported by Haxe.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; add&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// A function that takes 2 `Float`s and returns a `Float`.&lt;/span&gt;
                             &lt;span class="c1"&gt;// Unlike those functional languages that use such syntax,&lt;/span&gt;
                             &lt;span class="c1"&gt;// it is NOT the same as `Float-&amp;gt;(Float-&amp;gt;Float)`,&lt;/span&gt;
                             &lt;span class="c1"&gt;// nor equals to `(Float-&amp;gt;Float)-&amp;gt;Float` in Haxe.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The syntaxes for class/interface definition of TypeScript and Haxe are slightly different:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IGreeter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;greeting&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kr"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Greeter&lt;/span&gt; &lt;span class="kr"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;IGreeter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// fields are public by default&lt;/span&gt;
    &lt;span class="kr"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello, "&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;greeting&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kr"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;greet() {&lt;/span&gt;
        &lt;span class="c1"&gt;// use of `this.` is mandatory when accessing fields&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="n"&gt;IGreeter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// fields are public by default in interface def.&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; greeting&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Greeter&lt;/span&gt; &lt;span class="kd"&gt;implements&lt;/span&gt; &lt;span class="n"&gt;IGreeter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// fields are private by default in class def.&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt; greeting&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; hello &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Hello, "&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;greeting&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// use of `this.` is optional when accessing fields&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hello&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;TypeScript also provides some syntactic sugar, named “parameter properties”, for writing classes. The following two class definitions are semantically the same, but the former is written using “parameter properties”.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;

&lt;span class="c1"&gt;// class definition with "parameter properties"&lt;/span&gt;
&lt;span class="kr"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kr"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kr"&gt;public&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// normal class definition&lt;/span&gt;
&lt;span class="kr"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;name&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kr"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kr"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Haxe does not provides built-in short class syntax. But it can also be emulated quite easily with &lt;a href="http://haxe.org/manual/macro-type-building.html"&gt;build macros&lt;/a&gt;. The Haxe libraries, &lt;a href="https://github.com/ciscoheat/dataclass"&gt;dataclass&lt;/a&gt; and &lt;a href="https://github.com/haxetink/tink_lang#direct-initialization"&gt;tink_lang&lt;/a&gt;, provide similar functionality with different syntaxes.&lt;/p&gt;
&lt;p&gt;The ways TypeScript and Haxe define property get/setters are very different. The TypeScript one is straight forward. The Haxe one is pretty unique.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kr"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kr"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;_name&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="c1"&gt;// if it is allowed to be read by the public, define the following&lt;/span&gt;
    &lt;span class="nx"&gt;get&lt;/span&gt; &lt;span class="nx"&gt;name() {&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;// if it is allowed to be set by the public, define the following&lt;/span&gt;
    &lt;span class="nx"&gt;set&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;:&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Person&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// property with getter and setter&lt;/span&gt;
    &lt;span class="c1"&gt;// @:isVar auto generates a private `name`&lt;/span&gt;
    &lt;span class="nd"&gt;@:isVar&lt;/span&gt; &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt; name&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;get_name&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;set_name&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// read-only from other classes, but can be set by itself&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt; gender&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// constant read-only property&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt; type&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;never&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Person"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// set-only property&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt; birthday&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="n"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;set_birthday&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="n"&gt;Date&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;birthday&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// property that derived from something&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt; age&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;never&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;get_age&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;computeAge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;birthday&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Overall, on the surface, TypeScript and Haxe are quite similar, with minor differences where one is slightly more verbose than the other, or the opposite. The significant differences are: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Haxe has better expression syntax.&lt;/li&gt;
&lt;li&gt;TypeScript has better function type syntax.&lt;/li&gt;
&lt;li&gt;TypeScript has more built-in short-hands for writing functions and classes.&lt;/li&gt;
&lt;li&gt;Haxe is extensible by the use of macros, which may transform the semantics of specific expressions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Although the syntaxes are mostly similar, the underlying semantics of the codes in the two languages can be quite different. We will discuss more about the semantic differences of the two languages in the following section.&lt;/p&gt;
&lt;h3&gt;Semantics&lt;/h3&gt;
&lt;p&gt;TypeScript and Haxe have different decisions on variable scoping. TypeScript, like &lt;span class="caps"&gt;JS&lt;/span&gt;, offers only function-level scope for &lt;code&gt;var&lt;/code&gt; declarations. Haxe however provides block-level scope, which is also offered by most block-structured languages, like C/C++, Java, and C#. The difference is illustrated as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ok, because `a` exist outside of a block&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; a &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// error: Unknown identifier : a&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Generally, block scope is a better choice for a block-structured language. In fact, the creator of JavaScript, &lt;a href="https://en.wikipedia.org/wiki/Brendan_Eich"&gt;Brendan Eich&lt;/a&gt;, admitted that the design decision was made &lt;a href="https://twitter.com/brendaneich/status/349768501583548416"&gt;due to a lack of time&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Implement block scope? Aint nobody got time for that!" src="https://blog.onthewings.net/files/2015/js-block-scope-meme.jpg"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Of course, the &lt;span class="caps"&gt;ES6&lt;/span&gt; block scoped &lt;code&gt;let&lt;/code&gt; declaration is also supported by TypeScript. But it is kind of a pity that TypeScript has to maintain the old scoping strategy of &lt;code&gt;var&lt;/code&gt; and goes to support &lt;code&gt;let&lt;/code&gt; instead of “fixing” &lt;code&gt;var&lt;/code&gt; declaration directly like Haxe…&lt;/p&gt;
&lt;p&gt;It is in a similar situation for the resolution of &lt;code&gt;this&lt;/code&gt;. TypeScript &lt;a href="https://github.com/Microsoft/TypeScript/wiki/'this'-in-TypeScript"&gt;follows strictly the &lt;span class="caps"&gt;JS&lt;/span&gt; behavior&lt;/a&gt;. When &lt;code&gt;this&lt;/code&gt; is inside a function/method, it is resolved dynamically. &lt;code&gt;this&lt;/code&gt; may not always point to an instance of the enclosing “class”, depended on how the function/method is called. Haxe “fixes” it to use the more natural lexical scoping, and making it always points to an instance of the enclosing “class”. The difference is illustrated as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kr"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Counter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kr"&gt;private&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;buggy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;:&lt;span class="kt"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// `this` is not the Counter instance...&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;// one way to fix this is to alias `this` to a local variable&lt;/span&gt;
    &lt;span class="nx"&gt;fixed1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;:&lt;span class="kt"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;that&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;that&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;// another way is to use arrow function, which resolves&lt;/span&gt;
    &lt;span class="c1"&gt;// `this` in the natural way&lt;/span&gt;
    &lt;span class="nx"&gt;fixed2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;array&lt;/span&gt;:&lt;span class="kt"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;any&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;ints&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;buggy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ints&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;  &lt;span class="c1"&gt;// 0&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;fixed1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ints&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 3&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;fixed2&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ints&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 3&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Counter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; i &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(){}&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;correct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Dynamic&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Lambda&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;array&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Test&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; ints &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
        &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;correct&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ints&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt; &lt;span class="c1"&gt;// 3&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We can see another reason why Haxe does not need &lt;span class="caps"&gt;ES6&lt;/span&gt; arrow functions like TypeScript/&lt;span class="caps"&gt;JS&lt;/span&gt; - &lt;code&gt;this&lt;/code&gt; inside a function is resolved naturally by default.&lt;/p&gt;
&lt;p&gt;Both TypeScript and Haxe have enum types, but they are different things. A enum type in TypeScript is just a finite set of &lt;strong&gt;values&lt;/strong&gt; (integers to be exact). &lt;a href="http://haxe.org/manual/types-enum-instance.html"&gt;Enum in Haxe&lt;/a&gt; is a powerful functional programming construct called &lt;a href="https://en.wikipedia.org/wiki/Generalized_algebraic_data_type"&gt;generalized algebraic data type (&lt;span class="caps"&gt;GADT&lt;/span&gt;)&lt;/a&gt;, which is more like a finite set of &lt;strong&gt;types&lt;/strong&gt; (not real types in Haxe, just the concept). We may think of the TypeScript enum can only supports a subset of what the Haxe enum supports. Both TypeScript and Haxe enums are often used with switch, which is also semantically different across the two languages as described next.&lt;/p&gt;
&lt;p&gt;The TypeScript switch statement is the good old C-style switch, which is kind of like a fancy group of if-else statements. &lt;a href="http://haxe.org/manual/expression-switch.html"&gt;The Haxe switch expression&lt;/a&gt; is in fact yet another functional programming construct called &lt;a href="https://en.wikipedia.org/wiki/Pattern_matching"&gt;pattern matching&lt;/a&gt;. Here are some examples illustrating the use enum and switch in TypeScript and Haxe:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kr"&gt;enum&lt;/span&gt; &lt;span class="nx"&gt;Color&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Red&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;Green&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;Blue&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// an Array&amp;lt;Color&amp;gt;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;colors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Red&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Green&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Blue&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// every case here is a *value*&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nx"&gt;Color.Red&lt;/span&gt;:
        &lt;span class="kt"&gt;console.log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Red"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nx"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Red&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;// can never be reached, but is fine&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="c1"&gt;// missing `case Color.Green`, `case Color.Blue`, and `default`, but fine too&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;Color&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Red&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Green&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Blue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;Rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// an enum "constructor" may have arguments&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Test&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// an Array&amp;lt;Color&amp;gt;&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; colors &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Red&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)];&lt;/span&gt;

        &lt;span class="c1"&gt;// switch in Haxe is also an expression&lt;/span&gt;
        &lt;span class="c1"&gt;// note that there is NO fall-through, i.e. no `break` is needed&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; redValue &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;colors&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// every case here is a *pattern*, not a *value*&lt;/span&gt;
            &lt;span class="c1"&gt;// there will be compilation errors if there are missing or redundant cases&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Red&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;Rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;redValue&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 255&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We can see that the Haxe switch is more powerful that it can match against and “extract” the arguments (or even fields or array items) of the given object. It also performs exhaustiveness and useless pattern check to ensure there is no missing or redundant cases.&lt;/p&gt;
&lt;p&gt;TypeScript &lt;a href="https://github.com/Microsoft/TypeScript/issues/165"&gt;does not have pattern matching, yet&lt;/a&gt;, but it &lt;a href="https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#destructuring-in-declarations-and-assignments"&gt;supports the &lt;span class="caps"&gt;ES6&lt;/span&gt; destructuring declarations and assignments&lt;/a&gt;, which can be used for some of the pattern-matching use cases:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;point&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;point&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 100&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 0&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 0&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; point &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;point&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 100&lt;/span&gt;
        &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 0&lt;/span&gt;
        &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 0&lt;/span&gt;
    &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="s2"&gt;"It is not in the form of [x, y, z]"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;By now we have discovered quite a few cases where TypeScript and Haxe give different semantics to the same syntax. We can see that TypeScript sticks to the &lt;span class="caps"&gt;JS&lt;/span&gt; standards as much as possible. Existing &lt;span class="caps"&gt;JS&lt;/span&gt; developers would pick up TypeScript without any fiction. Haxe however takes the other approach, “fixes” the &lt;a href="http://www.crockford.com/javascript/javascript.html"&gt;&lt;span class="caps"&gt;JS&lt;/span&gt; design flaws&lt;/a&gt; and follows the behaviors used by other popular languages. As a result, developers with background other than &lt;span class="caps"&gt;JS&lt;/span&gt; would appreciate and less-likely to be surprised by the Haxe semantics. Moreover, Haxe also fuses functional programming concepts and &lt;span class="caps"&gt;JS&lt;/span&gt;-like syntax in a natural way.&lt;/p&gt;
&lt;h3&gt;Type system&lt;/h3&gt;
&lt;p&gt;TypeScript and Haxe feature similar basic types. TypeScript has &lt;code&gt;boolean&lt;/code&gt;, &lt;code&gt;number&lt;/code&gt;, &lt;code&gt;string&lt;/code&gt;, &lt;code&gt;Array&lt;/code&gt;, &lt;code&gt;any&lt;/code&gt;, and &lt;code&gt;void&lt;/code&gt;. Haxe has all of the TypeScript equivalents, &lt;code&gt;Bool&lt;/code&gt;, &lt;code&gt;Float&lt;/code&gt;, &lt;code&gt;String&lt;/code&gt;, &lt;code&gt;Array&lt;/code&gt;, &lt;code&gt;Dynamic&lt;/code&gt;, and &lt;code&gt;Void&lt;/code&gt;. In Haxe, there is also &lt;code&gt;Int&lt;/code&gt; that does not exist in TypeScript. As previously mentioned, we have function types in both languages too.&lt;/p&gt;
&lt;p&gt;We can create custom types in both TypeScript and Haxe. In TypeScript, we may use class/interface and enum. In Haxe, we have class/interface, enum, typedef, and abstract.&lt;/p&gt;
&lt;p&gt;TypeScript uses a structural type system (duck-typing), in which all types can be expressed as interfaces. Types are compatible to each other as long as they have the same fields. We can assign anonymous object to a variable typed as a class instance:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kr"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Point&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;x&lt;/span&gt;:&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;y&lt;/span&gt;:&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;pt&lt;/span&gt;:&lt;span class="kt"&gt;Point&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;:&lt;span class="kt"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt;:&lt;span class="kt"&gt;0&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// ok&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;We can even &lt;code&gt;implements&lt;/code&gt;, not only &lt;code&gt;extends&lt;/code&gt;, a class:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kr"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Greeter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"hi"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kr"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;ChineseGreeter&lt;/span&gt; &lt;span class="kr"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;Greeter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"你好！"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The type system of Haxe is stronger. Duck-typing is only allowed when assigning to variables of structure types:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Point&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt; x&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;var&lt;/span&gt; y&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&lt;span class="n"&gt;Void&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;typedef&lt;/span&gt; &lt;span class="n"&gt;PointStruct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Float&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Test&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&lt;span class="n"&gt;Void&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// A Point instance has the same structure as PointStruct.&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; p&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;PointStruct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Point&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// ok&lt;/span&gt;

        &lt;span class="c1"&gt;// An anonymous object is typed as a structure.&lt;/span&gt;
        &lt;span class="c1"&gt;// It is not a Point instance even if they have the same structure.&lt;/span&gt;
        &lt;span class="kd"&gt;var&lt;/span&gt; p&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Point&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt; &lt;span class="c1"&gt;// error: { y : Int, x : Int } should be Point&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Unlike TypeScript/&lt;span class="caps"&gt;JS&lt;/span&gt;, there is no implicit conversion from most types to &lt;code&gt;Bool&lt;/code&gt;/&lt;code&gt;Float&lt;/code&gt;/&lt;code&gt;Int&lt;/code&gt; in Haxe, except when using &lt;a href="http://haxe.org/manual/types-abstract-implicit-casts.html"&gt;abstract&lt;/a&gt;. Some examples:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;

&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    Common uses of implicit conversion&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;inputStr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;inputStr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// implicit conversion from string to bool&lt;/span&gt;
    &lt;span class="c1"&gt;// process&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"inputStr should not be empty"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;inputNum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;inputNum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// implicit conversion from number to bool&lt;/span&gt;
    &lt;span class="c1"&gt;// process&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"inputNum should be &amp;gt; 0"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    Crazy stuffs&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;

&lt;span class="c1"&gt;// http://wtfjs.com/2014/01/11/multiplying-arrays-and-objects&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;// 16&lt;/span&gt;
&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="c1"&gt;// 0&lt;/span&gt;
&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;// NaN&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="c1"&gt;// NaN&lt;/span&gt;
&lt;span class="p"&gt;({}&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt; &lt;span class="c1"&gt;// NaN&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;

&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    Be explicit most of the times.&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; inputStr &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inputStr&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// be explicit&lt;/span&gt;
    &lt;span class="c1"&gt;// process&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;js&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"inputStr should not be empty"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; inputNum &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inputNum&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// be explicit&lt;/span&gt;
    &lt;span class="c1"&gt;// process&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;js&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;alert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"inputNum should be &amp;gt; 0"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    Compilation error when doing crazy stuffs&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// error: Array&amp;lt;Int&amp;gt; should be Int&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Both TypeScript and Haxe offer compile-time type inference, but the Haxe one is slightly more sophisticated in the sense that it is able to infer type from the first use of the variable instead of just the initial value. It is illustrated as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     &lt;span class="c1"&gt;// var without init value nor type annotation is typed as `any`&lt;/span&gt;
&lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"abc"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// we can assign string to it&lt;/span&gt;
&lt;span class="nx"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// we can also assign number to it later, since `str` is `any`&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; str&lt;span class="p"&gt;;&lt;/span&gt;     &lt;span class="c1"&gt;// var without init value nor type annotation is typed as `Unknown`&lt;/span&gt;
&lt;span class="n"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"abc"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// once we assign a String to it, `str` is typed as `String`&lt;/span&gt;
&lt;span class="n"&gt;str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;   &lt;span class="c1"&gt;// error: Int should be String&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Haxe heavily relies on static typing, so it tries to be strict as much as possible. It does not simply type a variable as &lt;code&gt;Dynamic&lt;/code&gt; (the Haxe equivalent of &lt;code&gt;any&lt;/code&gt; in TypeScript) when there is no init value nor type annotation. Instead, it will type the variable as &lt;code&gt;Unknown&lt;/code&gt; (a &lt;a href="http://haxe.org/manual/types-monomorph.html"&gt;monomorph&lt;/a&gt;), and will try to figure out the type in later usage of the variable. To declare a &lt;code&gt;Dynamic&lt;/code&gt; variable, users have to explicitly state it (&lt;code&gt;var thing:Dynamic;&lt;/code&gt;). Similarly, Haxe by default does not allow &lt;code&gt;Array&lt;/code&gt; of mixed types, which is allowed by TypeScript:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"abc"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// the type of array is (string | number)[]&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; array &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"abc"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// error: Arrays of mixed types are &lt;/span&gt;
                          &lt;span class="c1"&gt;// only allowed if the type is forced to Array&amp;lt;Dynamic&amp;gt;&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; array&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Dynamic&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"abc"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// ok&lt;/span&gt;

&lt;span class="c1"&gt;// to get a union type like TypeScript's, use haxe.extern.EitherType&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; array&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;haxe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;extern&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;EitherType&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"abc"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;// ok&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Static typing of TypeScript is made optional, such that all valid &lt;span class="caps"&gt;JS&lt;/span&gt; code is valid TypeScript code. TypeScript even allows compilation when there is a type error when using a properly typed variable:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;first&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"Andy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;last&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"Li"&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;birthyear&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1988&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// error: Property 'birthyear' does not exist on type '{ first: string; last: string; }'.&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Although there is an error above, the TypeScript compiler still outputs &lt;span class="caps"&gt;JS&lt;/span&gt; as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// JavaScript&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;first&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Andy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;last&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Li"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;author&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;birthyear&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1988&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The same code above in Haxe will cause an compilation error and no output is produced. But note that we can force the Haxe compiler to ignore the type error:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Haxe&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; author &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Andy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;last&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Li"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="k"&gt;untyped&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;birthyear&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1988&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// prefix with `untyped`&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Unlike Haxe, TypeScript has a few unsound cases. For instance, function arguments should be contravariant, but &lt;a href="https://www.typescriptlang.org/docs/handbook/type-compatibility.html#function-parameter-bivariance"&gt;they are bivariant in TypeScript&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We can see that, Haxe is even more “typed” (has strict and sound typing) than TypeScript. On the one hand, TypeScript being forgiving on typing may be handy when we know what we’re doing. On the other hand, I’m not sure if it is good because it will somehow encourage people to ignore type errors instead of typing the program properly. To be clear, optional typing is nice, but when type annotation exists and there is clearly a typing issue, the compiler should complain and stop. One historical example of being error-forgiving caused issues in the long term is Internet Explorer. &lt;span class="caps"&gt;IE&lt;/span&gt; was so forgiving that people didn’t care about syntax errors nor web standards… Well, error-forgiveness is &lt;a href="http://blog.codinghorror.com/javascript-and-html-forgiveness-by-default/"&gt;good for end users&lt;/a&gt;, but bad for developers. Maybe it has become a Microsoft tradition - to encourage bad coding practice via forgiveness :(&lt;/p&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="It's a miracle! It compiles! Your type error is forgiven." src="https://blog.onthewings.net/files/2015/type-error-has-been-forgiven-meme.jpg"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;Code organization and generation&lt;/h3&gt;
&lt;p&gt;TypeScript and Haxe employ different strategies for code organization and generation.&lt;/p&gt;
&lt;p&gt;For code organization, TypeScript is as flexible as &lt;span class="caps"&gt;JS&lt;/span&gt;. A &lt;code&gt;.ts&lt;/code&gt; file may contain statements as well as functions and class definitions. We can optionally use the &lt;a href="http://www.typescriptlang.org/Handbook#modules"&gt;module systems&lt;/a&gt;, which there are three of them, internal, external, and the &lt;span class="caps"&gt;ES6&lt;/span&gt; modules. Internal modules are similar to namespaces. External modules are used when we want to output files in either the node.js (&lt;a href="http://wiki.commonjs.org/wiki/CommonJS"&gt;CommonJS&lt;/a&gt;) way or the require.js (&lt;a href="https://github.com/amdjs/amdjs-api"&gt;&lt;span class="caps"&gt;AMD&lt;/span&gt;&lt;/a&gt;) way. The &lt;a href="https://github.com/Microsoft/TypeScript/wiki/What%27s-new-in-TypeScript#es6-modules"&gt;&lt;span class="caps"&gt;ES6&lt;/span&gt; modules&lt;/a&gt; are effectively the external modules with a different syntax. All of the module systems are able to export variables, functions, and types, and can be mixed and matched at will.&lt;/p&gt;
&lt;p&gt;Haxe follows the more restrictive Java approach for code organization. It does not allow expressions (including functions) to be place in the top-level. Instead, Haxe expressions are held by types (mainly classes) contained in a &lt;code&gt;.hx&lt;/code&gt; file (i.e. a  &lt;a href="http://haxe.org/manual/type-system-modules-and-paths.html"&gt;module&lt;/a&gt;). Each module may contain more than one type. The main entry point of a Haxe program is a static main function of a class specified by the user.&lt;/p&gt;
&lt;p&gt;For file organization, TypeScript allows the &lt;code&gt;.ts&lt;/code&gt; files to be placed in anywhere. We may instruct the TypeScript compiler to generate one &lt;code&gt;.js&lt;/code&gt; file for each &lt;code&gt;.ts&lt;/code&gt; file, or to concatenate multiple &lt;code&gt;.ts&lt;/code&gt; output into a single &lt;code&gt;.js&lt;/code&gt; file. To reference other types declared in another &lt;code&gt;.ts&lt;/code&gt; file, insert a special comment &lt;code&gt;/// &amp;lt;&amp;lt;reference path="path/to/file.ts" /&amp;gt;&lt;/code&gt; or use &lt;code&gt;import&lt;/code&gt; and &lt;code&gt;require&lt;/code&gt;, depending on what module system we’re using. &lt;/p&gt;
&lt;p&gt;Haxe again follows the Java approach for file organization. It enforces a folder structure according to the use of packages/modules. e.g. If there is a module, &lt;code&gt;net.onthewings.HelloWorld&lt;/code&gt;, it must be located in a file named &lt;code&gt;HelloWorld.hx&lt;/code&gt; in the folder &lt;code&gt;net/onthewings/&lt;/code&gt; within one of the class paths searched by the Haxe compiler. The Haxe compiler compiles all the source files into a single &lt;code&gt;.js&lt;/code&gt; file. Referencing other modules is done by using &lt;a href="http://haxe.org/manual/type-system-import.html"&gt;&lt;code&gt;import&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Other than the different handling of “modules”, different levels of optimization can be found in the outputs of TypeScript and Haxe. TypeScript does not do much fancy optimization when transpiling TypeScript code to &lt;span class="caps"&gt;JS&lt;/span&gt; code. It is mostly a one to one mapping, except it has to generate code to implement features that are missing in traditional &lt;span class="caps"&gt;JS&lt;/span&gt; (e.g. arrow function is compiled to normal function when targeting &lt;span class="caps"&gt;ES3&lt;/span&gt;/5). Haxe, however, is able to perform a number of advanced optimizations. For example, &lt;a href="http://haxe.org/manual/cr-dce.html"&gt;dead-code-elimination&lt;/a&gt; removes unused code to reduce output size and improve runtime performance. &lt;a href="http://haxe.org/manual/class-field-inline.html"&gt;Inlining&lt;/a&gt; directly inserts user-specified function bodies in place of calls to them, effectively reduces number of function calls for runtime performance improvement. The experimental static analyzer available in &lt;a href="http://haxe.org/download/version/3.2.0/"&gt;Haxe 3.2&lt;/a&gt; is able to perform constant propagation and expression-level dead-code-elimination.&lt;/p&gt;
&lt;p&gt;TypeScript and Haxe continues to follow their design strategies consistently in the area of code organization and generation. TypeScript wants to be as flexible as and similar to &lt;span class="caps"&gt;JS&lt;/span&gt;. It supports all the &lt;span class="caps"&gt;JS&lt;/span&gt; code organization methods. It maintains a trivial mapping between source code and generated &lt;span class="caps"&gt;JS&lt;/span&gt; code. Haxe, however, borrows the concepts of other popular compiled languages. It enforce a single sensible source directory structure and generates only a single &lt;span class="caps"&gt;JS&lt;/span&gt; file by default. It is able to perform various optimizations on the program.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;TypeScript and Haxe are similar in many aspects. They are both statically typed languages that are able to compile to &lt;span class="caps"&gt;JS&lt;/span&gt;. They have similar &lt;span class="caps"&gt;JS&lt;/span&gt;-like syntax and features.&lt;/p&gt;
&lt;p&gt;However, at the core, TypeScript and Haxe have different design philosophies. TypeScript is a superset of &lt;span class="caps"&gt;JS&lt;/span&gt;. It means it cannot modify the existing &lt;span class="caps"&gt;JS&lt;/span&gt; syntax and semantics. It adds a static type system and some new constructs (e.g. “proper” class/interface). It is not interested in optimizing the program in any way. Haxe looks like &lt;span class="caps"&gt;JS&lt;/span&gt;, but is more similar to other popular compiled languages like Java/C# regarding to semantics, the use of types, code organization, and optimizations. It also brings in a lot of advanced functional programming concepts.&lt;/p&gt;
&lt;p&gt;Which is the better compile-to-&lt;span class="caps"&gt;JS&lt;/span&gt; language? It depends. Existing &lt;span class="caps"&gt;JS&lt;/span&gt; developers will favor TypeScript as they are more similar in many ways. They can utilize their existing skills immediately. Non-&lt;span class="caps"&gt;JS&lt;/span&gt; developers with backgrounds like Java/C# or even from the functional programming world will appreciate Haxe more since it fixes a lot of weirdness of &lt;span class="caps"&gt;JS&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Personally I would of course recommend Haxe over TypeScript. Not only because that is the language I use, but also because outside of the compile-to-&lt;span class="caps"&gt;JS&lt;/span&gt; context, TypeScript is nothing… But Haxe is able to target not only &lt;span class="caps"&gt;JS&lt;/span&gt;, but also Java, C#, C++, &lt;span class="caps"&gt;PHP&lt;/span&gt;, Python, Flash (&lt;span class="caps"&gt;AS3&lt;/span&gt;/swf), and Neko ;)&lt;/p&gt;</content><category term="Haxe"></category><category term="JS"></category></entry><entry><title>Including External JS Lib in Haxe Output</title><link href="https://blog.onthewings.net/2015/07/22/including-external-js-lib-in-haxe-output/" rel="alternate"></link><published>2015-07-22T00:00:00+08:00</published><updated>2015-07-22T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2015-07-22:/2015/07/22/including-external-js-lib-in-haxe-output/</id><summary type="html">&lt;p&gt;One missing feature of the &lt;a href="https://blog.onthewings.net/2015/07/02/new-jquery-extern-arrived-at-haxe-std-lib/"&gt;new Haxe std jQuery extern&lt;/a&gt; from the old one is the ability to embed jQuery directly into the Haxe &lt;span class="caps"&gt;JS&lt;/span&gt; output. Although often it is better to use a &lt;a href="http://jquery.com/download/#using-jquery-with-a-cdn"&gt;&lt;span class="caps"&gt;CDN&lt;/span&gt;&lt;/a&gt;, which may improve page loading performance by allowing parallel downloads and increasing the chance of …&lt;/p&gt;</summary><content type="html">&lt;p&gt;One missing feature of the &lt;a href="https://blog.onthewings.net/2015/07/02/new-jquery-extern-arrived-at-haxe-std-lib/"&gt;new Haxe std jQuery extern&lt;/a&gt; from the old one is the ability to embed jQuery directly into the Haxe &lt;span class="caps"&gt;JS&lt;/span&gt; output. Although often it is better to use a &lt;a href="http://jquery.com/download/#using-jquery-with-a-cdn"&gt;&lt;span class="caps"&gt;CDN&lt;/span&gt;&lt;/a&gt;, which may improve page loading performance by allowing parallel downloads and increasing the chance of cache-hits (as well as &lt;a href="http://stackoverflow.com/a/2180401/267998"&gt;other reasons&lt;/a&gt;), sometimes it is just handy if the Haxe compiler could embed jQuery into the &lt;span class="caps"&gt;JS&lt;/span&gt; output such that we don’t have to add another line of &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag in our &lt;span class="caps"&gt;HTML&lt;/span&gt; file.&lt;/p&gt;
&lt;p&gt;Turn out I was not able to port that feature to the new extern that easily. Let’s take a look at how the old extern did it. The magic lies within the &lt;a href="https://github.com/HaxeFoundation/haxe/blob/3.2.0/std/js/JQuery.hx#L398-L409"&gt;&lt;code&gt;__init__&lt;/code&gt;&lt;/a&gt; method, which has a macro function call as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="n"&gt;haxe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;macro&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Compiler&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;includeFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"js/jquery-latest.min.js"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;span class="center"&gt;
&lt;a href="http://haxememes.tumblr.com/post/42315290417"&gt;&lt;img alt="There's a macro for that!" src="https://blog.onthewings.net/files/2015/theres_a_macro_for_that.jpg"/&gt;&lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;So, yeah, if you didn’t know, now you have learned that we have a macro named &lt;a href="http://api.haxe.org/haxe/macro/Compiler.html#includeFile"&gt;&lt;code&gt;includeFile&lt;/code&gt;&lt;/a&gt; to include any external file into the &lt;span class="caps"&gt;JS&lt;/span&gt; output. The function was implemented in pure Haxe, and was quite simple, so lets go through its &lt;a href="https://github.com/HaxeFoundation/haxe/blob/3.2.0/std/haxe/macro/Compiler.hx#L333-L349"&gt;source code&lt;/a&gt; together:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="k"&gt;macro&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;includeFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;fileName&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Expr&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;        Extract the input, `fileName`, as a String.&lt;/span&gt;
&lt;span class="cm"&gt;    */&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; str &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;expr&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;EConst&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;CString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Should be a constant string"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;        Load the file content into variable `f`.&lt;/span&gt;
&lt;span class="cm"&gt;    */&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; f &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;File&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getContent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resolvePath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Dynamic&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Std&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;        Return an expression, which is in the form of `untyped __js__("file_content")`.&lt;/span&gt;
&lt;span class="cm"&gt;        Note that it can be written in a simpler way using expression reification:&lt;/span&gt;
&lt;span class="cm"&gt;        ```&lt;/span&gt;
&lt;span class="cm"&gt;        return macro untyped __js__($v{f});&lt;/span&gt;
&lt;span class="cm"&gt;        ```&lt;/span&gt;
&lt;span class="cm"&gt;    */&lt;/span&gt;
    &lt;span class="kd"&gt;var&lt;/span&gt; p &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;currentPos&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;expr&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;EUntyped&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;expr&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ECall&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;expr&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;EConst&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CIdent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"__js__"&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;expr&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;EConst&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;CString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;]),&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In short, the macro function loads the file content and injects it directly using &lt;a href="http://haxe.org/manual/target-javascript-injection.html"&gt;&lt;code&gt;__js__&lt;/code&gt;&lt;/a&gt;. As a function to inject simple &lt;span class="caps"&gt;JS&lt;/span&gt; code, it is simple and elegant. However it is not really suitable for including &lt;span class="caps"&gt;JS&lt;/span&gt; libs due to how Haxe generates &lt;span class="caps"&gt;JS&lt;/span&gt; code, which looks like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Generated by Haxe&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"use strict"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    1. classes generation, e.g. class inheritance, methods etc. &lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;
&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    2. __init__ of all classes&lt;/span&gt;
&lt;span class="cm"&gt;    jQuery will be embeded here&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;
&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    3. static variables generation&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;
&lt;span class="nx"&gt;Test&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;})(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"undefined"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){}});&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Firstly, we notice that Haxe wraps everything in a closure by default. It avoids global variables being exposed to the outside world. Inside the closure, we enable &lt;a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Strict_mode"&gt;strict mode&lt;/a&gt;, which improves performance and eliminates &lt;span class="caps"&gt;JS&lt;/span&gt; silent errors by changing them to throw errors. It is good for Haxe since its &lt;span class="caps"&gt;JS&lt;/span&gt; output is compatible with strict mode. But the &lt;span class="caps"&gt;JS&lt;/span&gt; lib we want to include may not. In fact, &lt;a href="https://github.com/jquery/jquery/issues/1779"&gt;recent versions of jQuery are incompatible with strict mode&lt;/a&gt;. The out-dated jQuery version 1.6.4, which is included by the old extern, just happens to be strict mode compatible, ironically. That’s why this problem didn’t surface until I try to update jQuery.&lt;/p&gt;
&lt;p&gt;Secondly, classes generation comes &lt;em&gt;before&lt;/em&gt; the &lt;code&gt;__init__&lt;/code&gt;s, which is the place where &lt;span class="caps"&gt;JS&lt;/span&gt; libs are embedded. It means that Haxe generated classes cannot inherit from classes of the external &lt;span class="caps"&gt;JS&lt;/span&gt; libs. It is not a problem for jQuery, since we do not often inherit from it, but it could be a problem if we want to use a &lt;span class="caps"&gt;JS&lt;/span&gt; lib that is structured using a more &lt;span class="caps"&gt;OOP&lt;/span&gt; approach.&lt;/p&gt;
&lt;p&gt;To solve these issues, we have to find a way to place the external files before everything generated by Haxe, including the closure. And since it depends on how Haxe &lt;span class="caps"&gt;JS&lt;/span&gt; code generation works, we have to modify the compiler source. The good news is, I’ve just &lt;a href="https://github.com/HaxeFoundation/haxe/pull/4419"&gt;done that&lt;/a&gt; so you don’t have to :)&lt;/p&gt;
&lt;p&gt;I’ve added a new optional argument to &lt;code&gt;haxe.macro.Compiler.includeFile&lt;/code&gt;, named &lt;code&gt;position&lt;/code&gt;, for us to specify the position of where the injection takes place. There is three possible values, &lt;code&gt;Top&lt;/code&gt; (default), &lt;code&gt;Closure&lt;/code&gt;, and &lt;code&gt;Inline&lt;/code&gt;. &lt;code&gt;Inline&lt;/code&gt; is the old behavior, which inject the file content at the call site of &lt;code&gt;includeFile&lt;/code&gt;. The two new positions are illustrated as follows:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="c1"&gt;// Generated by Haxe&lt;/span&gt;
&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    new include position: `Top`&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"use strict"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    new include position: `Closure`&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;
&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    1. classes generation, e.g. class inheritance, methods etc. &lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;
&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    2. __init__ of all classes&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;
&lt;span class="cm"&gt;/*&lt;/span&gt;
&lt;span class="cm"&gt;    3. static variables generation&lt;/span&gt;
&lt;span class="cm"&gt;*/&lt;/span&gt;
&lt;span class="nx"&gt;Test&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;})(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s2"&gt;"undefined"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){}});&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Problem solved! The default position, &lt;code&gt;Top&lt;/code&gt;, is outside of the closure, not in strict mode, and it is before everything else.&lt;/p&gt;
&lt;p&gt;As a bonus, we can now call &lt;code&gt;includeFile&lt;/code&gt; within a hxml file, like so:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;-js Main
-main Main.js
--macro includeFile('path/to/dependencies.js')
&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;It could be useful if you use &lt;a href="https://www.npmjs.com/"&gt;npm&lt;/a&gt; or &lt;a href="http://bower.io/"&gt;bower&lt;/a&gt; to manage &lt;span class="caps"&gt;JS&lt;/span&gt; dependencies. We can concatenate all the dependencies into a single file and pass it to &lt;code&gt;includeFile&lt;/code&gt;. I’m still experimenting with this approach. So, more on that later.&lt;/p&gt;</content><category term="Haxe"></category><category term="JS"></category></entry><entry><title>New jQuery Extern arrived at Haxe Standard Library</title><link href="https://blog.onthewings.net/2015/07/02/new-jquery-extern-arrived-at-haxe-std-lib/" rel="alternate"></link><published>2015-07-02T00:00:00+08:00</published><updated>2015-07-02T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2015-07-02:/2015/07/02/new-jquery-extern-arrived-at-haxe-std-lib/</id><summary type="html">&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="jQuery logo" src="https://blog.onthewings.net/files/2015/jQuery-Logo.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; has been &lt;del&gt;one of&lt;/del&gt; &lt;a href="http://trends.builtwith.com/javascript/"&gt;the most popular JavaScript library&lt;/a&gt; in the world. To help existing &lt;span class="caps"&gt;JS&lt;/span&gt; developers switch to Haxe for a modern language with accurate static typing, a complete and up-to-date jQuery extern is necessary.&lt;/p&gt;
&lt;p&gt;As I’ve mentioned in the &lt;a href="https://blog.onthewings.net/2015/06/23/im-now-working-for-the-haxe-foundation/"&gt;previous post&lt;/a&gt;, I’m working on updating …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="jQuery logo" src="https://blog.onthewings.net/files/2015/jQuery-Logo.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt; has been &lt;del&gt;one of&lt;/del&gt; &lt;a href="http://trends.builtwith.com/javascript/"&gt;the most popular JavaScript library&lt;/a&gt; in the world. To help existing &lt;span class="caps"&gt;JS&lt;/span&gt; developers switch to Haxe for a modern language with accurate static typing, a complete and up-to-date jQuery extern is necessary.&lt;/p&gt;
&lt;p&gt;As I’ve mentioned in the &lt;a href="https://blog.onthewings.net/2015/06/23/im-now-working-for-the-haxe-foundation/"&gt;previous post&lt;/a&gt;, I’m working on updating the jQuery extern in the Haxe standard library. Today, I’ve just committed the initial work to the Haxe repo. The new extern is generated by the same script that powers &lt;a href="https://github.com/andyli/jQueryExternForHaxe"&gt;jQueryExtern&lt;/a&gt;. The resulting extern matches perfectly with the latest jQuery &lt;span class="caps"&gt;API&lt;/span&gt; (1.11.3 / 2.1.4). And since it is generated, we can update the extern very easily when there is a new jQuery release (I used less than an hour for each of the previous updates to jQueryExtern).&lt;/p&gt;
&lt;p&gt;The differences between the old and the new externs are detailed at &lt;a href="https://github.com/HaxeFoundation/haxe/issues/4377"&gt;Github issue #4377&lt;/a&gt;, where you may report any migration issue or provide any feedback. Go ahead and get a &lt;a href="http://builds.haxe.org"&gt;development build of Haxe&lt;/a&gt; and play with the new extern!&lt;/p&gt;</content><category term="Haxe"></category><category term="jQuery"></category></entry><entry><title>I’m Now Working for the Haxe Foundation!</title><link href="https://blog.onthewings.net/2015/06/23/im-now-working-for-the-haxe-foundation/" rel="alternate"></link><published>2015-06-23T00:00:00+08:00</published><updated>2015-06-23T00:00:00+08:00</updated><author><name>Andy Li</name></author><id>tag:blog.onthewings.net,2015-06-23:/2015/06/23/im-now-working-for-the-haxe-foundation/</id><summary type="html">&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Haxe Foundation logo" src="https://blog.onthewings.net/files/2015/haxe-fondation.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Yeah, I’ve completed my PhD and I’m now working for the &lt;a href="http://haxe.org/foundation/"&gt;Haxe Foundation&lt;/a&gt;!&lt;/p&gt;
&lt;h1&gt;My 4-year-long PhD has come to an end&lt;/h1&gt;
&lt;p&gt;I started my PhD in the &lt;a href="http://www.scm.cityu.edu.hk/"&gt;School of Creative Media (&lt;span class="caps"&gt;SCM&lt;/span&gt;), City University of Hong Kong&lt;/a&gt; right after I’ve completed my Bachelor degree there.
&lt;!-- SCM is interdisciplinary. There are courses on media stuffs like photography, animation, and creative writing, as well as regular computer science stuffs for building interactive installations and games. Naturally, when it comes to research, it is possible to focus on either arts or computer science. Although they are both interesting to me, I took the science side, as I can appreciate and identify good science research better than the arts papers. You know, art theories are somewhat abstract and it is hard to argue whether a piece of modern art is better than the other. But it is relatively easy to reason about computer algorithms or products in terms of time complexity or usability. And I'm better at coding then writing anyway. --&gt;
I entered …&lt;/p&gt;</summary><content type="html">&lt;p&gt;&lt;span class="center"&gt;
&lt;img alt="Haxe Foundation logo" src="https://blog.onthewings.net/files/2015/haxe-fondation.png"/&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Yeah, I’ve completed my PhD and I’m now working for the &lt;a href="http://haxe.org/foundation/"&gt;Haxe Foundation&lt;/a&gt;!&lt;/p&gt;
&lt;h1&gt;My 4-year-long PhD has come to an end&lt;/h1&gt;
&lt;p&gt;I started my PhD in the &lt;a href="http://www.scm.cityu.edu.hk/"&gt;School of Creative Media (&lt;span class="caps"&gt;SCM&lt;/span&gt;), City University of Hong Kong&lt;/a&gt; right after I’ve completed my Bachelor degree there.
&lt;!-- SCM is interdisciplinary. There are courses on media stuffs like photography, animation, and creative writing, as well as regular computer science stuffs for building interactive installations and games. Naturally, when it comes to research, it is possible to focus on either arts or computer science. Although they are both interesting to me, I took the science side, as I can appreciate and identify good science research better than the arts papers. You know, art theories are somewhat abstract and it is hard to argue whether a piece of modern art is better than the other. But it is relatively easy to reason about computer algorithms or products in terms of time complexity or usability. And I'm better at coding then writing anyway. --&gt;
I entered the field of mobile interface design and computer graphics with the help of my supervisor, &lt;a href="http://sweb.cityu.edu.hk/hongbofu/"&gt;Dr. Hongbo Fu&lt;/a&gt;. Two of my major research projects are &lt;a href="http://sweb.cityu.edu.hk/hongbofu/projects/BezelCursor/"&gt;BezelCursor&lt;/a&gt; and &lt;a href="http://sweb.cityu.edu.hk/hongbofu/projects/EZSketching_SIG14/"&gt;&lt;span class="caps"&gt;EZ&lt;/span&gt;-Sketching&lt;/a&gt;. The former is a screen cursor that helps people to use only one hand to operate a large mobile device, in which part of the touchscreen may not be covered by the limited thumb reach area. The latter is a image tracing system that automatic refines drawing strokes based on the features of the underlying image. You may take a look at my &lt;a href="https://www.academia.edu/12882228/Accessibility_Extensibility_and_Accuracy_in_Mobile_Device_Interaction"&gt;thesis&lt;/a&gt; if you’re interested.&lt;/p&gt;
&lt;p&gt;Doing a PhD was very challenging to me. Yes, I had already learned some regular computer science stuffs during my Bachelor degree study, but I was not really ready to read research papers, to write equations with weird symbols, and to properly analyze experiment results with statistical procedures. With my PhD completed now, I can say that mastering those research skills is super useful and rewarding. There are a lot of interesting research papers being presented in conferences which I don’t think I would ever pay attention to if I were not a researcher.&lt;/p&gt;
&lt;p&gt;However, although doing research is cool, it is still a bit different to what I enjoy most - coding. Computer science researchers do not really spend all their time on coding, not even on doing “real” research works. They have to spend a large portion of their time on publishing papers. Although the papers are of course valuable to the public, the whole academic publishing process is somewhat frustrating to me. The top academic conferences, like &lt;a href="http://www.siggraph.org/"&gt;&lt;span class="caps"&gt;SIGGRAPH&lt;/span&gt;&lt;/a&gt;, often have very low acceptance rates (&lt;a href="http://kesen.realtimerendering.com/"&gt;~20%&lt;/a&gt;). Papers have to be really “exciting” and “ground-breaking” in order to be published there. But you know, most research may not be such interesting or such a breakthrough, yet can still be valuable in many ways. For example, publishing a paper on a new algorithm that can solve complex problems may be cool, but providing and &lt;strong&gt;maintaining&lt;/strong&gt; a solid open source implementation is equally (if not more) important. I’ve seen a lot of researchers keep working on new stuffs (in order to keep publishing papers), but spend little effort in maintaining their software/code, reducing the chance of people using their research outputs.&lt;/p&gt;
&lt;h1&gt;Working for the Haxe Foundation&lt;/h1&gt;
&lt;p&gt;As mentioned above, I value maintaining open source software very much, so it is very cool for me to work on Haxe in full-time. :)&lt;/p&gt;
&lt;p&gt;I have been using Haxe for 5 years. I have published a few libraries, like &lt;a href="https://github.com/andyli/jQueryExternForHaxe"&gt;jQueryExtern&lt;/a&gt; and &lt;a href="https://github.com/andyli/hxSerial"&gt;hxSerial&lt;/a&gt;. At some point I’ve also published &lt;a href="https://github.com/andyli/hxOpenFrameworks"&gt;hxOpenFrameworks&lt;/a&gt; and used it to create &lt;a href="https://www.flickr.com/photos/andy-li/sets/72157625719497466"&gt;generative graphics&lt;/a&gt;. At that time Haxe wasn’t very stable and the C++ target was still young. I decided to contribute directly to the Haxe repository since it is definitely the most important part of the Haxe ecosystem. The Haxe compiler (and its standard library) has to be robust and stable such that third party libraries and frameworks, like hxOpenFrameworks and &lt;a href="http://www.openfl.org/"&gt;OpenFL&lt;/a&gt;, can be built on top of it. In my free time during my PhD study, I introduced continuous integration (&lt;span class="caps"&gt;CI&lt;/span&gt;) to the Haxe repositories. It is satisfying to see the Haxe unit tests are now being run for all the 9 targets on both &lt;a href="https://travis-ci.org/HaxeFoundation/haxe"&gt;Mac/Linux&lt;/a&gt;, &lt;a href="https://ci.appveyor.com/project/HaxeFoundation/haxe/"&gt;Windows&lt;/a&gt;, as well as &lt;a href="https://saucelabs.com/u/haxe"&gt;browsers&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Since I had defended my PhD thesis, I was available to attend &lt;a href="http://wwx.silexlabs.org/2015/"&gt;&lt;span class="caps"&gt;WWX&lt;/span&gt; 2015&lt;/a&gt;, in which I presented &lt;span class="caps"&gt;CI&lt;/span&gt; to the Haxe community (&lt;a href="https://docs.google.com/presentation/d/1AcqUbB_Zn5dQyxpv9BYokOXMPuEcYEXMA7w6E50kpNo/edit?usp=sharing"&gt;my presentation slides&lt;/a&gt;). Using &lt;a href="https://travis-ci.org/"&gt;TravisCI&lt;/a&gt; and &lt;a href="http://www.appveyor.com/"&gt;AppVeyor&lt;/a&gt; is so easy that I really want to see every Haxe projects on Github to use them. During the conference I talked with &lt;a href="https://twitter.com/ncannasse"&gt;Nicolas&lt;/a&gt; about working for the Haxe Foundation, and he was happy about it! So, yes. I am now financially supported by the Haxe Foundation to maintain and develop for Haxe in full-time!&lt;/p&gt;
&lt;p&gt;The very first task that I’ve just started to work on is to upgrade jQuery support in the Haxe standard library. The build-in support was added back in 2011. It has never been a complete extern. A lot of APIs are missing, including &lt;a href="https://github.com/HaxeFoundation/haxe/pull/4026"&gt;parseXML&lt;/a&gt;, some overloaded versions of &lt;a href="https://github.com/HaxeFoundation/haxe/pull/4078"&gt;bind/unbind&lt;/a&gt;, &lt;a href="https://github.com/HaxeFoundation/haxe/pull/3045/files"&gt;on&lt;/a&gt; etc. Also, it has been staying at jQuery 1.6.4 for a long time (latest version as of writing is 1.11.3). My &lt;a href="https://github.com/andyli/jQueryExternForHaxe"&gt;jQueryExtern&lt;/a&gt; library has been complete and up-to-date, which is even being &lt;a href="http://haxe.org/use-cases/web/"&gt;mentioned&lt;/a&gt; in the haxe.org website. I’m now modifying &lt;a href="https://github.com/andyli/jQueryExternForHaxe/blob/master/jQuery/haxe/gen/CoreExternGenerator.hx"&gt;jQueryExtern’s generation script&lt;/a&gt; to generate a new set of externs for the standard library, maximizing compatibility between old and new version of the externs. jQueryExtern itself will be maintained as a drop-in replacement of the new standard library extern, to provide &lt;a href="https://github.com/andyli/jQueryExternForHaxe/wiki/Haxe-3#config"&gt;addition functionalities&lt;/a&gt;. Initial implementation will be completed soon and I will ask for your feedback once it is ready.&lt;/p&gt;
&lt;p&gt;For every month, I will work on a specific task, like the jQuery support upgrade. I will also work on other haxe-related things concurrently, e.g. updating the &lt;a href="https://blog.onthewings.net/2015/01/28/installing-haxe-on-windows-using-chocolatey/"&gt;Haxe Chocolatey package&lt;/a&gt;, fixing &lt;span class="caps"&gt;CI&lt;/span&gt; issues, writing docs, and try to wrap my head around OCaml and start fixing compiler bugs. I will also speak at local and nearby conferences and meet-ups, to introduce Haxe to other developers. For instance, I am going to speak at the &lt;a href="http://2015.opensource.hk/agenda/topic/transcompiling-towards-the-freedom-of-programming-language-and-platform-choice/"&gt;Hong Kong Open Source Conference 2015&lt;/a&gt; this week. I will keep posting a blog post weekly, to publicly report the progress. So stay turned if you’re interested in what I’m working for Haxe.&lt;/p&gt;</content><category term="Haxe"></category></entry></feed>