Automated source translation of C++ to D
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Sat Sep 6 14:46:48 PDT 2014
On Saturday, 6 September 2014 at 18:42:43 UTC, Andrej Mitrovic
via Digitalmars-d wrote:
> On 8/21/14, Walter Bright via Digitalmars-d
> <digitalmars-d at puremagic.com> wrote:
>> The trouble is, D is not a perfect superset of C++, not even
>> close
>
> I don't think that's important for porting. To quote:
>
> -----
> Engineering teams at Mozilla and Epic ported the award-winning
> Unreal
> Engine 3 (UE3) to the Web in just four days using the powerful
> combination of asm.js and Emscripten, which enables developers
> to
> compile C++ code into JavaScript.[1]
> -----
>
> [1] :
> https://www.unrealengine.com/news/epic-games-releases-epic-citadel-on-the-web
>
> I'm still amazed that this is even possible. But it makes me
> think
> what does JS have over D that makes this possible? I have a
> feeling
> it's only down to the number and capability of people working
> on such
> a project which guarantees it's success (JS is important, and
> the
> Unreal Engine is important).
asm.js is NOT javascript.
asm.js is a bytecode format for native code, and a very
inefficient one for that matter, as it uses the same syntax as
javascript.
One of the said advantage of this format, is that it is
retro-compatible with javascript. That mean that the bytecode can
be interpreted as javascript and still works.
For some values of "works".
Indeed, run as javascript, asm.js is an order of magnitude
slower. You can consider that compatible for toy program, but the
reason to use asm.js to begin with is performance, and so an
order of magnitude slower is not acceptable.
For the example of unity, that means unplayable games.
Once you understand that this retro-compatibility with javascript
argument is bullshit, it is easily understood that asm.js is
simply a variant of pNaCl, that uses bloated bytecode to provide
extra useless features and create fragmentation.
Brendan Eich being CTO of mozilla when they dropped pNaCl in
favor of asm.js is probably relevant.
More information about the Digitalmars-d
mailing list