Why neko is not written in haxe?

310 views
Skip to first unread message

Séb Patu

unread,
Oct 30, 2013, 4:17:29 AM10/30/13
to haxe...@googlegroups.com
Hi all,
in my quest of finding a debugger for haxe code, whatever target you use, i was wondering why nekoVM was not written in haxe?
if it was the case, or if at least we had a VM in haxe which supports all platforms, it could be easy to add a Socket based debugger in the VM.
thus when we need to debug haxe code, we run the program on this hxVM which itself run on the wanted target.
and IDE can communicate with debugger threw sockets

The main advantage would be to debug any haxe project that heavely use target specific libraries threw externs.

performances should not be so important in debug mode anyway

if you still need to debug in the transcompiled code result in target code itself, it would be because of a bug in haxe->target compilation, not in haxe project itself. So in that case, you'll still have to debug in target code but it should be rare, and fixed in haxe compiler. if it is not possible, it means the haxe promise to target all platforms is broken.

what do you think?
Seb

Marc Weber

unread,
Oct 30, 2013, 4:36:40 AM10/30/13
to haxelang
Let me add another question:
Why isn't the haxe compiler written in haxe ?

This could be related.
http://lib.haxe.org/p/hscript

Back to your question:

haxe translates to
- Java
- PHP
- JavaScript
- .net
- as3 (with some tweaking?)
- C/C++
source code

and all of those have debuggers. AFAIK some work has been done on
improving debugging for haxe. Try searching the mailinglist.

Haxe itself does allow you to modify the code before it gets compiled by
macro post processing or such (at least JS backend).
Haxe has a -debug flag already. That adds tracing code for exceptions or
the like.

So maybe it can already be done what you're looking for (assuming they
all behave exactly the same - which they eventually don't if you have
corner cases)

Excerpts from Séb Patu's message of Wed Oct 30 09:17:29 +0100 2013:
> in my quest of finding a debugger for haxe code, whatever target you use, i
> was wondering why nekoVM was not written in haxe?

Nekovm is a "general purpose virtual machine which makes it easy to run
functional applications such as haxe".

I only tried to list options which exist. I hope that others can comment
what of those ideas actually does work nicely.

Marc Weber

Séb Patu

unread,
Oct 30, 2013, 4:59:30 AM10/30/13
to haxe...@googlegroups.com
Hi thanks for your answer.

Maybe my question is not good.
Neko may not have to be written in haxe because haxe does not suit well to VM coding, like haxe may not suit well to compiler coding, compared to OCAML.

But the question is: is it easier to code a VM in haxe, or port neko to all targets?

About the today's possibilities of debug in haxe:
when i say debugger i think of step by step debugger like we already have with haxe on flash target, not only tracing.
And theres quite a difference to debug in haxe directly, compared to debugging in the output code from haxe compiler. i tried with php target and its quite not fun.

The mapping solution like we have with haxe js, is not as good as the VM solution, because it more difficul to integrate in a single IDE.

Nicolas Cannasse

unread,
Oct 30, 2013, 6:13:45 AM10/30/13
to haxe...@googlegroups.com
Le 30/10/2013 09:17, S�b Patu a �crit :
> Hi all,
> in my quest of finding a debugger for haxe code, whatever target you
> use, i was wondering why nekoVM was not written in haxe?
> if it was the case, or if at least we had a VM in haxe which supports
> all platforms, it could be easy to add a Socket based debugger in the VM.
> thus when we need to debug haxe code, we run the program on this hxVM
> which itself run on the wanted target.
> and IDE can communicate with debugger threw sockets

NekoVM is not written in Haxe since C/C++ are more suitable for this
work. However there are ways to emulate the NekoVM in Haxe, see
https://github.com/HaxeFoundation/format/blob/master/format/neko/VM.hx

This is far from complete, but I think Cau� had a more complete version
running.

Best,
Nicolas

Séb Patu

unread,
Oct 30, 2013, 7:06:28 AM10/30/13
to haxe...@googlegroups.com
yes sorry again my title is not good.
my main concern is about a VM in haxe to ccreate a "universal debugger" for haxe.
Do you think it is a good and achievable approach nicolas?

emulating neko in haxe may be a way to do it? it sounds hat it is the case to me.
Where can we find the more up to date version?

Le mercredi 30 octobre 2013 11:13:45 UTC+1, Nicolas Cannasse a écrit :
Le 30/10/2013 09:17, S�b Patu a �crit :
> Hi all,
> in my quest of finding a debugger for haxe code, whatever target you
> use, i was wondering why nekoVM was not written in haxe?
> if it was the case, or if at least we had a VM in haxe which supports
> all platforms, it could be easy to add a Socket based debugger in the VM.
> thus when we need to debug haxe code, we run the program on this hxVM
> which itself run on the wanted target.
> and IDE can communicate with debugger threw sockets

NekoVM is not written in Haxe since C/C++ are more suitable for this
work. However there are ways to emulate the NekoVM in Haxe, see
https://github.com/HaxeFoundation/format/blob/master/format/neko/VM.hx

This is far from complete, but I think Cau� had a more complete version
running.

Best,
Nicolas

Marc Weber

unread,
Oct 30, 2013, 7:40:20 AM10/30/13
to haxelang
Excerpts from Séb Patu's message of Wed Oct 30 12:06:28 +0100 2013:
> Do you think it is a good and achievable approach nicolas?
If it works it'll nice. I'd expect some problems to be solved with
"interfacing" with external libraries eventually.

Eg how do you compile to neko interfacing with external whatsoever JS
libraries so that you can debug it?

Marc Weber

Justin L Mills

unread,
Oct 30, 2013, 7:46:07 AM10/30/13
to haxe...@googlegroups.com
Seb

Caue posted about it on the haxelang but I don't have all the emails to search.  But check his github account, I found this one
https://github.com/waneck/neko

not sure if it is the correct one.

I am not sure Neko in JS or flash would run fast enough, although I am curious about how Neko would run in PHP if such a beast was ever created, it would be funny if it ran faster otherwise apart from the JVM version Caue was looking at I don't think the concept flies it's probably something you need to test before you can see if it's useful.

Best Justin
--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/groups/opt_out.

Séb Patu

unread,
Oct 30, 2013, 8:00:19 AM10/30/13
to haxe...@googlegroups.com
Thanks Justin, but i did not find it :(
i found interesting croxit project :) too bad it seems dead now.

about the fast of Neko in JS, flash, php may not be very interesting, again my point here is to get a debugger, so fast is not required.

@Marc: im not sure to understand what you mean, but i would say that we don't need to get acces to the extern libraries code when debug, we only need to be able to run them and debug the haxe code that use them.
don't neko supports externs already?

Cauê Waneck

unread,
Oct 30, 2013, 8:09:03 AM10/30/13
to haxe...@googlegroups.com
Hey Séb!

2013/10/30 Séb Patu <seb...@gmail.com>

Thanks Justin, but i did not find it :(

It's private by now, as it's a little messy atm. You should be able to implement a debugger on top of it. If you're interested I can open it up for you.
 
i found interesting croxit project :) too bad it seems dead now.

Well, I use croxit on a daily basis at work :) So it's not dead.
Also, I'm working on the next version, which will support desktop and android as well ;)

Marc Weber

unread,
Oct 30, 2013, 8:24:46 AM10/30/13
to haxelang
Excerpts from Séb Patu's message of Wed Oct 30 13:00:19 +0100 2013:
> @Marc: im not sure to understand what you mean, but i would say that we
> don't need to get acces to the extern libraries code when debug, we only
> need to be able to run them and debug the haxe code that use them.
> don't neko supports externs already?

Externs for neko are "shared libraires / C level"
Externs for JS are just plain JS definitions to call.

Thus its trivial to compile down to neko, but its non trivial to
interface with jquery for instance if you compile to neko.

So yes, there are externs for all backends, but the implementation is
different.

Marc Weber

Séb Patu

unread,
Oct 30, 2013, 9:27:32 AM10/30/13
to haxe...@googlegroups.com
Hi Cauê
I'm definetally interested to see it opened up :)
its not big priority, because i have a lot to do before tring to do such a debugger, but im happy it seems to be doable, and theres enough to start with.
its subject that comes so often, about adoption of Haxe: documentation, IDE, step by step debugger.

about croxit:
by dead, i meant no update about new targets :p
world war z zoombie if you prefer, very agressive but no fresh blood ;)

good to know theres a new version on tracks.
do you have any calendar plan for this new release? is it significantly faster than phonegap?

thanks for the great work guys!

Cauê Waneck

unread,
Oct 30, 2013, 10:19:48 AM10/30/13
to haxe...@googlegroups.com
2013/10/30 Séb Patu <seb...@gmail.com>
Hi Cauê
I'm definetally interested to see it opened up :)
its not big priority, because i have a lot to do before tring to do such a debugger, but im happy it seems to be doable, and theres enough to start with.
its subject that comes so often, about adoption of Haxe: documentation, IDE, step by step debugger.

Okay. Let me know. I'll probably get into a cleaner state soon - no date, sorry! 

about croxit:

do you have any calendar plan for this new release?
 
Not yet. Got too much going on lately, but it should be ready still this year.
 
is it significantly faster than phonegap?
 
Well, it depends on your coding style. Croxit helps you minimize the work done by the JS frontend - which can be important if you want to e.g. manipulate binaries, such as images.
Also since it has a native backend, it allows to more easily interact with underlying system without the need of serializing the data to/from JS.
This is specially useful for mobile applications, which already have constrained hardware. On iOs in special, it's important as it doesn't provide JIT compilation for JS.

But most importantly (for me at least), is that it allows writing an application and being able to deploy for both web and stand-alone, with the exact same code-base. We normally test the application on the neko test server before deploying to the device, and we've had some applications that later were turned into websites,  and vice-versa.

Reply all
Reply to author
Forward
0 new messages