What is neko any way?-Collection of common programming errors

Neko for most people is nothing more than a Haxe target. That’s not technically true (it does have it’s own language, and could potentially be a target for other languages), but for most people, Neko is a target that Haxe outputs to.

In the same way the Java Virtual Machine (JVM) can be targetted from multiple languages (See the list on wikipedia). For Neko however, most people seem to use it Haxe to create their *.n files.

For Haxe programmers, the neko target lets you:

  • Write command line tools and utilities (for example, haxelib and haxedoc are written in haxe targetting neko)
  • Write web apps or dynamic web pages – using mod_neko (or mod_tora) you get a web processor with the same sort of capabilities as PHP, but a fair bit faster.
  • Create games with NME (which originally started with Neko, it stands for Neko Media Engine), and compile them quickly, having a target closer to what CPP has, but which compiles a lot faster and where the output is cross platform.
  • A runtime that is closely tied into Haxe and can be used from within macros etc – so you can use all of the neko.* classes inside Macros.

If you’re only interested in targetting SWF or JS, you’ll probably not have much need for Neko. But if you are writing server side code, you’ll appreciate the performance, and if you are writing CPP, you may appreciate having a simple target that is dead easy and super quick to compile, and which behaves similarly to CPP.

Of course, outside of Haxe neko is it’s own language… but to me at least it seems most people just use it with Haxe.

More Info:

If you want to write in the neko language (See this tutorial) you save as “myfile.neko” and compile with nekoc myfile.neko which will compile to “myfile.n”.

If you want to write in the Haxe language, you save your file as “MyFile.hx” and compile with “haxe -neko myfile.n -main MyFile”.

The “myfile.n” that is generated by both of these doesn’t have human readable source code – this is the neko bytecode. You can run it on any computer that has neko installed by running neko myfile.n. You can turn it into an executable (that runs without neko installed) for your platform/OS by running nekotools boot myfile.n.

Here is a tutorial on Getting Started With Neko, which covers both command line programs you write and (very very basic) web pages.