Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread NodeJS + EWB... interesting?
Sat, Oct 8 2022 11:01 AMPermanent Link

erickengelke

Avatar

NodeJS and EWB

NodeJS is a stable JavaScript runtime environment based on the V8 JavaScript engine.  It’s often used for writing server environments, but it can also be used for command-line programs.  It’s used extensively and is very reliable.

It adds the following to Javacsript
-   Full File i/o
-   Networking
-   Registry editing options
-   Many rich libraries available through NPM
-   Etc.

So it can be used as a cross-platform scripting language because it is available for Windows, OS/X, Linux on Intel, Arm, etc.   A write-once, deploy-anywhere solution for scripting anything non-graphical.  This contrasts with typical EWB usage where you have full GUI access through a web browser, but limited access to the file, registry and other resources of the computer.  Actually, you can integrate the two by running the NodeJS server in the background and the Gui in a browser connected to localhost, this splitting of functionality is how many Unix solutions work, and is also similar to Portable Web Apps (PWA’s).

Back to NodeJS.  All it needs is a JavaScript program and bindings for the various functions.  The resulting programs are small compared to Delphi binaries doing the same thing.  While it’s not a drop-in replacement for Delphi, it may mean some people could replace Delphi in many of their workflows with a different cross-platform solution without the $1000+ expense of Enterprise Delphi.

Furthermore, it offers Synchronous well as Asynchronous versions of most functions, so you don’t have to write in awkward Promises, you can do things like read a file from disk in one function call, then proceed to the next line.

It also can be debugged on the command line or remotely using Chrome’s remote debugging tool.  I’ve never tried this… perfect code and all Smile

I’ve successfully written a few utilities using EWB + NodeJS, bringing the benefits of Pascal to the table.  These are non-trivial command line programs I would have otherwise written in Delphi.   The only technical requirement to run them is to download a recent version of the Node.JS runtime environment, just as one might have to load the current .Net RunTimeEnvironment.  The RTE is relatively big, but need only be downloaded during install and upgrades.

NodeJS + EWB ALMOST works perfectly, but a weird limitation in the current EWB compiler (I won’t get into it here, but I suspect it’s a very minor bug because it just ignores USE’d libraries in certain functions) prevents more widespread applications being immediately doable.  I have sent an approximately 15 line program to Tim demonstrating the apparent flaw.  I’m hopeful he can remove this limitation because it seems to be so minor and strangely present.

When the compiler is updated, I share more information on this development.  I just thought I’d mention it now to gauge interest and get people thinking once.

Thanks for reading this long post.

Erick
EWB Programming Books and Component Library
http://www.erickengelke.com
Sat, Oct 8 2022 11:39 AMPermanent Link

erickengelke

Avatar

More details:

One of the reasons this is interesting to me is because I program on Raspberry Pis and cheap and tiny (matchbook sized) $16 RockPi S (https://shop.allnetchina.cn/products/rock-pi-s) microcontrollers for some applications.   They run a full Linux stack and include Wifi and Ethernet connectivity.  There are banana pis, orange pis, and other similar devices which you can substitute for different features and price points.

Currently my apps on them are written in PHP for portability, but my heart is in Pascal.  My Pascal options are FreePascal cross-compiling or EWB + NodeJS.  Each has different advantages.  But working within one ecosystem has benefits too.

Some Embarcadero employees have successfully ported Delphi to the Raspberry Pi (Delphi does generate Arm code too), ages ago but have not released it publicly, and I think it was more proof-of-concept than production quality.

Erick
EWB Programming Books and Component Library
http://www.erickengelke.com
Tue, Oct 11 2022 11:11 AMPermanent Link

Ralf Mimoun

Interesting + interested!
Tue, Oct 11 2022 11:59 AMPermanent Link

erickengelke

Avatar

Ralf Mimoun wrote:
> Interesting + interested!

There is currently a limitation of EWB 3 for non-Graphical Web projects that use the pascal USE for included files with Classes.  Those classes are only usable from the main pascal function (to steal a name from C).  Other functions or procedures generate a compile error if they try to use an included class.  I don't know why that is, probably something simple to overcome.

Once that limitation is removed, it should be ready to go.

Erick
EWB Programming Books and Component Library
http://www.erickengelke.com
Sat, Oct 22 2022 2:15 AMPermanent Link

Allen Hunt

erickengelke wrote:

> When the compiler is updated, I share more information on this development.  I just thought I’d mention it now to ?> gauge interest and get people thinking once.

Thank you! I'm Interested!
Sat, Oct 22 2022 5:48 PMPermanent Link

Steve Gill

Avatar

I'm interested too.
Tue, Oct 25 2022 10:36 AMPermanent Link

Bill

Me too!
Tue, Oct 25 2022 10:54 AMPermanent Link

erickengelke

Avatar

I see the bug that was preventing this technology is fixed in today's update 8, so I'll try compiling it again tonight and report back with news.

Erick
EWB Programming Books and Component Library
http://www.erickengelke.com
Image