Following this thread on Hacker News
Ask HN: How do you decide for a backend language?
commented in How do you decide for a backend language?
I got a question from ZenoArrow
RedTamarin does look like a great project, and I'm impressed by how much effort you've clearly put into it.
I was just curious, what are your thoughts about Haxe? It's not quite the same as AS3, but it is meant to be fairly similar.
here the answer
you got almost the answer here "It's not quite the same as AS3"
Haxe focus on transpilation/cross-compilation with its own language 'Haxe' and its own compiler, libraries, VM, etc.
The closest to Redtamarin would be the NekoVM http://nekovm.org
I would say it is a different approach, Redtamarin focus on AS3 the language but also on the AVM2 and by extension the reuse of the Flex SDK (for the compiler) and other tooling that already exists (like Flash Builder IDE).
And so when you compare Haxe/NekoVM to AS3/AVM2 the difference mainly shine in how you write programs and libraries.
Redtamarin approach is to provide a "C API" for low-level function and other syscall, so dev can write "as fast as if they were writing AS3 as usual", they only need to learn a new API and the subtleties of system programming.
You could find the same kind of differences with CrossBdrige https://github.com/adobe-flash/crossbridge
Both NekoVM and CrossBridge focus (in their own way) on the reuse of C/C++ libraries, e.g. if you need zlib you can reuse it, but then it forces you to compile native stuff.
Redtamarin almost opposite approach is to provide a kind of C standard library (POSIX like even) in the context of AS3/AVM2, which allow you to port or write the AS3 code to do native stuff in a cross-platform way, but you can not reuse external native libs like zlib.
See for example this getaddrinfo sample code ported from C to AS3 https://twitter.com/zwetan/status/752202410521726976
The logic for that is let's say you need popen2.popen2() from Python, you can implement it in AS3 reusing C functions like popen(), pipe(), fork(), dup2(), close(), etc.
Except for fork(), the AS3 code will work under Linux / Mac OS X.
You could say that Redtamarin is a lot of hard work to add small native C functions call, so dev can easily write AS3 programs for command-line and server-side.
Another example, you can take JS (ECMAScript, ECMA-262) code, compile it and run it with the redshell, I did it with the TypeScript compiler, I just needed to implement ChakraHost, the detail is here https://discuss.as3lang.org/t/the-case-when-you-dont-want-node-js/307
So to come back to Haxe/NekoVM, I'm not so sure you could either implement popen2.popen2() with just the system libraries available or if you could just compile/run TSC sources with Haxe/NekoVM unless making a big rewrite of the whole thing.
Many people probably think that AS3 is dead because "flash is dead", but AS3 is also ES4 and so fully compatible with ECMA-262, being able to reuse IDE with just a little swap of playerglobal.swc with redtamarin.swc and instantly have syntax completion to write server-side program, publishing documentation with tools like asdoc, etc.
All those things are the reason why Redtamarin focus on AS3 the language, and why it is very different than Haxe and/or NekoVM.
to add a bit more, this part
as fast as if they were writing AS3 as usual
is the most important, it is really about knowledge reuse
there are some difficult parts like
- learning to compile for Redtamarin with
- understanding why you would need to use includes
- or just learning a new API like the C API
but if you do know ActionScript 3.0 you can actually reuse quite a lot with Redtamarin
from structuring a program with classes, to porting an AS3 library so it can work on the command-line, etc.
in fact I could even argue if you don't know AS3 but know just a bit of JS or even better TypeScript,
to get started with Redtamarin is quite easy.