
The Neko Virtual Machine - azhenley
https://nekovm.org/
======
k_
Neko has been around for 10+ years and is being replaced progressively by HL
(HashLink, [1]), from the same creator.

I mainly know Neko as one of many transpiling targets for Haxe programming
language [2] (10+ targets including JS, PHP, C++), and have used it many years
ago for all my backend stuff.

[1]: [https://hashlink.haxe.org/](https://hashlink.haxe.org/) [2]:
[https://haxe.org/](https://haxe.org/)

~~~
Gama11
I'm also surprised that Neko has been posted here rather than HashLink, which
is much more impressive:

\- unlike Neko, the bytecode is strictly typed, allowing it to be much faster

\- there are two different ways to use it:

    
    
      - HL/JIT, compiling to bytecode and using the VM
    
      - HL/C, compiling to raw C code to gain an extra bit of performance and allow it to run on devices that don't allow JIT (mobile / consoles)
    

\- the successful indie games Northgard (by the Haxe / HashLink creator
himself) and Dead Cells use HashLink as their runtime

\- there is a VSCode breakpoint debugger for it
([https://marketplace.visualstudio.com/items?itemName=HaxeFoun...](https://marketplace.visualstudio.com/items?itemName=HaxeFoundation.haxe-
hl))

\- in the future, support for hot-reloading bytecode is coming
([https://github.com/HaxeFoundation/hashlink/issues/145](https://github.com/HaxeFoundation/hashlink/issues/145))

~~~
azhenley
Sorry, I found Neko for the first time and didn't see any mention of HL on the
Neko website. HashLink does look very impressive so thanks for the details.
I'm looking into it now.

~~~
Gama11
That is a good point, a mention on the Neko website would make sense.

------
logicprog
[edited after reading FAQ]

Minor criticism: It would be helpful to see some code so you can tell what
you're going to have to be generating to use the VM. Especially since it's not
bytecode or abstract machine instructions so it's hard to know what to expect.

Otherwise, this is an incredibly cool project, which I'm definitely going to
check out more in the future. Out of curiosity, how does its performance and
memory usage compare versus the JVM or even LLVM (for the standalone
compiler)? It's a super cool idea to have a lightweight standardized VM to
program for, but I think generating bytecode or LLVM IR would be easier to
design a programming language atop, at least because it'd be less likely to be
a leaky abstraction like JS transpilers. So it'd be nice to know if any more
technical benefits.

One technical question, (forgive me I don't know what I'm talking about) why
have a bytecode at all, since no users of the languages based on Neko VM will
touch Neko PL themselves (usually), why can't Neko PL act as a bytecode?

~~~
Gama11
Neko isn't that fast, since the bytecode is dynamically typed. That combined
with the fact that it's not really actively developed anymore, you'd probably
be better off checking out its successor called "HashLink" instead (see
comment thread above).

Btw, a JVM target (generating JVM bytecode directly) was recently merged into
the Haxe compiler. Previously there was already a target that generates Java
source code, but that had some issues like slowing down compile times with the
native Java compilation step that needed to be done.

~~~
johnday
Why would types speed up the code?

~~~
cygx
Static types avoid the cost of runtime type checks and dynamic dispatch.

~~~
naasking
Also they permit more inlining opportunities, allow eliminating more dead
code, and more. Types almost always improve program performance.

------
neals
I always used Neko as the default VM to run Haxe code. I used it the same way
most people now use NodeJS: tooling, simple webserver, quick prototype.

These days, I start new projects in NodeJS because teams don't know about
Neko. Which is a shame because Neko and the Haxe language solve most critisism
of NodeJS and JS in general.

~~~
Gama11
Haxe's JavaScript target works great in combination with Node as well though.
:)
([https://github.com/HaxeFoundation/hxnodejs](https://github.com/HaxeFoundation/hxnodejs))

For instance, the Haxe VSCode extension itself is a Node project written in
Haxe.

------
dirkc
A long time ago I used HaXe to create a flash based magazine DVD without
having to install windows [1]. I'm glad to see that HaXe is stil around, I
enjoyed using it!

[1]: [http://www.thebacklog.net/2008/11/12/open-source-flash-
workf...](http://www.thebacklog.net/2008/11/12/open-source-flash-workflow/)

------
TheRealPomax
Without attribution, it's pretty unclear where these quotes are coming from.
Are they just made up? If so... those aren't quotes =/

------
sail0rm00n
Looks awesome! Do you have any code samples/examples?

~~~
rafaelvasco
Neko is indeed amazing. But is pretty much dead. Check its successor:
[https://hashlink.haxe.org/](https://hashlink.haxe.org/).

