[Pas2js] Pas2js 0.9.24

Michael Van Canneyt michael at freepascal.org
Sun Jun 3 08:28:16 CEST 2018



On Sun, 3 Jun 2018, Ryan Joseph wrote:

>
>
>> On Jun 2, 2018, at 5:40 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>> 
>> I have been working towards pas2js (in fact a full web development stack for FPC) since 2008 or thereabouts.
>
> I thought this was something you made in a few months by hijacking the FPC parser. Big project I guess.

Indeed.

For pas2js, a parser was needed. A syntax tree (AST) was needed.
Luckily these were mostly there from fpdoc, but fpdoc needed only the
interface part.

For pas2js you also need the implementation.
Then the same is needed for JS - pas2js converts a pascal syntax tree to
javascript syntax tree. 
Then you need something to write out the JS syntax tree.

But a full development stack is more than just pas2js, the compiler.
You also need development tools:

* It also means a data exchange mechanism with a server.
   There is a server side mechanism for JSON data and a client-side one.
* There is a JSON RPC mechanism.
* A reporting mechanism that can run on a webserver (fpReport). 
* For fpReport a good expression parser was needed - this is fpExprPars.

All these things exist now in FPC.

> Since you mention it, how do you think pas2js compares against a framework
> like https://reactjs.org?  I know a little about React except that it’s
> very popular and well liked.  I always made web pages in HTML/CSS/PHP but
> maybe the next time it comes up I could use pas2js.

react is just a Javascript library. Providing bindings for it is something
that is on my TODO list. Similar for Angular or Vue.js. 
Since I like Vue.js best,  I will probably start with that.
(there are other such systems in JS)

> The first thing I notice is that React has a nice way to “intermingle"
> HTML right into the source (PHP was famous for this back in the day) but
> pas2js lacks this.  Is making embedded HTML strings with interpolation of
> variables like React or PHP does something you thought about?  Unless I’m
> totally off base tight HTML integration is paramount for front end web
> stuffs but maybe there’s a better way.

Actually, this is why React is last on my list. 
I think that they way in which they intermingle HTML and javascript is a really bad idea.

It is why I prefer Angular or Vue.js, there it is more separated.

Long story short: pas2js in time will provide bindings to these frameworks,
but I have no plans to recreate something similar to these frameworks in
pas2js.

There is work enough as it is :)

Michael.


More information about the Pas2js mailing list