[Pas2js] mighty milestone: self compiling pas2js

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Nov 4 10:45:26 CET 2018


On Sat, 3 Nov 2018 22:05:25 -0400
johnathan dhoe <johndhoe9123 at gmail.com> wrote:

> I won't knock the achievement on a purely technical level, but from a
> practical standpoint, what exactly is the intended use case for this?
> Why specifically would I want to use the NodeJS version, when the
> native Pascal version will always of course be significantly faster?

The nodejs version is indeed purely technical. 

It is about 10 times slower. I don't know yet how much this is due to
missing optimizations of pas2js (e.g. sets). But it gives you a rough
estimate that the produced code can compete with many server languages
even when parsing strings, which is not a strong point of JS.

Why nodejs:
As a command line utility the compiler was easiest to port and debug as
a command line utility.

Benefits:
It helped to spot 30 bugs, I added some new features like {$i
%date%}, and I got a big testsuite. :)
Non technical benefit is the prove that you can write code cross
platform with reasonable amount of IFDEFs and having a rough estimate
about the speed to expect.

 
> In my view, the whole draw of Pas2JS as a concept is that it allows
> you to *avoid* directly writing JavaScript (which is a generally bad,
> very poorly designed language by all accounts) as much as possible,
> instead remaining in Pascal and simply letting the transpiler do the
> work.

Exactly.

Mattias


More information about the Pas2js mailing list