Recent

Author Topic: Pas2JS for the masses  (Read 9867 times)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Pas2JS for the masses
« on: December 23, 2018, 07:22:44 pm »
I've been playing around with Pas2JS in the last couple of weeks. Glad to see it come out as a wonderful tool. However, I don't find its usage any straightforward. FYI, I'm on Linux.

The most cumbersome problem is the packaging. Starting from the wiki article, I download a precompiled snapshot from the ftp to get the compiler binary, compileserver a.k.a. simpleserver, webidl2pas and libpas2js.so. There are various demos and packages ready to use. However, contrary to the wiki article, which says:
Quote
As for the FPC compiler, a configuration file is supported, which has the same syntax as the FPC config file. Note that the snapshots and svn version already contains a default pas2js.cfg with unit search paths (-Fu) for the rtl and fcl.
There's no pas2js.cfg in the distributed snapshot. Digging in pas2js in my fpc source code, I do find one, so I just copy it to the bin directory of the snapshot. Analyzing the content, though, it seems to be designed to be used inside its directory in fpc source code, so I have to adjust some of the paths to reflect the snapshot hierarchy. During that process, there's a line that says:
Quote
-Fu$CfgDir/dist
that points to a non-existing dir dist. Again browsing fpc source code, it's found and contains a single rtl.js file, which is referenced in the wiki article but not mentioned elsewhere where to get it. Again I copy the dir to bin to match that -Fu line (because my pas2js.cfg is in the bin directory) and trying out the hello world example (from the wiki article) only to find out that it refers to rtl.run(); without ever referencing rtl.js (I thought -Jc option will do, but it doesn't as the first line starts with rtl.module, where rtl is an unknown object. With that fixed, finally the example works.

That experience is certainly not friendly at all, I can go through it just because I'm quite experienced in using fpc and I have good enough sense of exploration. For anyone else coming to try, it will be a showstopper. I don't think I want to put above steps into my tutorial, I'd rather wait for the packaging to be user friendly first.

P.S.:
It's unclear to me how the snapshot was generated, a make install in the pas2js directory only installs the binaries and seemingly useless lib directory, no packages, no demos, dist directory and pas2js.cfg excluded.

lainz

  • Hero Member
  • *****
  • Posts: 4468
    • https://lainz.github.io/
Re: Pas2JS for the masses
« Reply #1 on: December 23, 2018, 10:08:59 pm »
install it with fpcupdeluxe and it just works

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Pas2JS for the masses
« Reply #2 on: December 24, 2018, 11:30:55 am »
I agree with Leledumbo here.  Pas2js documentation is confusing, specially in the installation and configuration parts.  I've never be able to make it run, and I tried different versions and times (and complained about it in this forums IIRC).

Didn't knew about fpcupdeluxe.  That needs more detailed information (here and in the documentation).
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Pas2JS for the masses
« Reply #3 on: December 24, 2018, 11:49:48 am »
install it with fpcupdeluxe and it just works
I don't even know it can be installed that way, really the documentation and/or packaging need an improvement.

Thaddy

  • Hero Member
  • *****
  • Posts: 14358
  • Sensorship about opinions does not belong here.
Re: Pas2JS for the masses
« Reply #4 on: December 24, 2018, 12:45:40 pm »
install it with fpcupdeluxe and it just works
I don't even know it can be installed that way, really the documentation and/or packaging need an improvement.
I agree with that. At the moment only experienced people can install and use it without too many problems. Fpcdeluxe doesn't help too much, btw. Paths are missing as you already observed.
OTOH it is being worked on and it is nice technology. It will mature over time.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

heejit

  • Full Member
  • ***
  • Posts: 245
Re: Pas2JS for the masses
« Reply #5 on: December 24, 2018, 06:18:06 pm »
Why not add to Online Package Manager it will be easier for everyone.

Thaddy

  • Hero Member
  • *****
  • Posts: 14358
  • Sensorship about opinions does not belong here.
Re: Pas2JS for the masses
« Reply #6 on: December 24, 2018, 06:26:45 pm »
Why not add to Online Package Manager it will be easier for everyone.
It IS in OPM. But not correctly configured.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Pas2JS for the masses
« Reply #7 on: December 25, 2018, 11:08:19 pm »
Why not add to Online Package Manager it will be easier for everyone.
Having it both in OPM and as standalone package (like fpc zip archive) is better than only in either. Standalone package will be useful for coding directly on server, i.e. for quickfix.

heejit

  • Full Member
  • ***
  • Posts: 245
Re: Pas2JS for the masses
« Reply #8 on: December 26, 2018, 10:19:35 am »
Yes both required

Installation and configuration of development environment should be easy
as copy and paste no need to dig into config file looking for library etc.



Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Pas2JS for the masses
« Reply #9 on: December 26, 2018, 11:13:55 am »
Problems seems to be:
  • Documentation is outdated and/or incomplete.
  • OPM package is outdated or buggy or incomplete.
  • There's not an out-of-the-box package (i.e. deb, rpm, ZIP ...) for people who don't use Lazarus.
So somebody that knows how does it work should fix that.  Better before Lazarus 2.0 comes out.
« Last Edit: December 26, 2018, 11:15:57 am by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

mattias

  • Administrator
  • Full Member
  • *
  • Posts: 184
    • http://www.lazarus.freepascal.org
Re: Pas2JS for the masses
« Reply #10 on: February 18, 2019, 06:24:24 pm »
There's no pas2js.cfg in the distributed snapshot.

Bug.  That is fixed in 1.4.

RTOlivier

  • Newbie
  • Posts: 6
Re: Pas2JS for the masses
« Reply #11 on: May 18, 2023, 02:32:29 am »
Hello, 

Do anyone know where I can find new version Pas2js ? 
Is anyone still use it ?  Seems like there's no activity anymore. 

Thank you

PierceNg

  • Sr. Member
  • ****
  • Posts: 373
    • SamadhiWeb
Re: Pas2JS for the masses
« Reply #12 on: May 18, 2023, 03:10:59 am »
Do anyone know where I can find new version Pas2js ? 
Is anyone still use it ?  Seems like there's no activity anymore. 

https://wiki.freepascal.org/pas2js#Where_to_get_it

pas2js wiki pages are being regularly updated

RTOlivier

  • Newbie
  • Posts: 6
Re: Pas2JS for the masses
« Reply #13 on: May 19, 2023, 12:25:45 pm »
I know but there is no release anymore after 2022-02-21.

Unlike dwscript for example, which is updated regularly, pas2js seems already dead. It'a a nice prosuct and I wantes to build my project on it.

TRon

  • Hero Member
  • *****
  • Posts: 2496
Re: Pas2JS for the masses
« Reply #14 on: May 19, 2023, 12:30:43 pm »
I know but there is no release anymore after 2022-02-21.

Unlike dwscript for example, which is updated regularly, pas2js seems already dead. It'a a nice prosuct and I wantes to build my project on it.
Yeah as dead as a ghost. https://gitlab.com/freepascal.org/fpc/pas2js/-/commits/main

Strange that you feel that way as it is one of the latest additions to FPC and one that is updated on a regular base.

 

TinyPortal © 2005-2018