Recent

Author Topic: Your thoughts on cross platform coding ie pascal, python and javascript  (Read 8850 times)

Julius7

  • New Member
  • *
  • Posts: 19
Hello everyone:

I would like to get your thoughts on cross platform coding ie pascal, python and javascript.

I been thinking of getting back into coding. I want to climb back into the saddle and get some coding done in some newer tech.  I been looking at some things such a python and I recently stumbled on lazarus with fpc.

I have a few questions.
a) According to the faq it implies that Lazarus can even run on a Mac ( I assume if Max is running on Intel chipset only) As far as I know the new Macs are really a copy of an older Debian that Apple copied and made a few changes and some cosmetics layered on top and wrapped it up in shiny Apple paper and branded it as Mac OS.

b) Does an Lazarus app / program run fast enough on a Mac, Linux and Windows.
Is it really mainly write one and compile and run it ok, as long as you do not too much "system" stuff. and write most portable code?

c) I have old retired computers, that I hope to pull out my old books and all of my old notes and files off of, and maybe one day start to write it all in something more cross platform.  I am guessing but I think I have some old stuff from long time in various flavours of c++, ie
 C++ or cpp  in bgi (Borland graphics interface?),
 cpp in mfc (ms foundation class?)
and cpp in something like owl (object windows library? (Borland or ms?)

Can you give me advice on some documents or web pages to read to port old code?


c) would Lazarus be a better choice than python

d) is javascript a better choice to do everything in a "browser application"?

thank you for your advice.

js

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #1 on: February 17, 2018, 02:10:58 pm »
a) According to the faq it implies that Lazarus can even run on a Mac ( I assume if Max is running on Intel chipset only) As far as I know the new Macs are really a copy of an older Debian that Apple copied and made a few changes and some cosmetics layered on top and wrapped it up in shiny Apple paper and branded it as Mac OS.
At least Free Pascal is also is able to run on PPC powered macs. There is a mac portal on the wiki and MacOS X installation tips (which includes a compatibility matrix).

Here is a list of supported targets.

Quote
b) Does an Lazarus app / program run fast enough on a Mac, Linux and Windows.
Is it really mainly write one and compile and run it ok, as long as you do not too much "system" stuff. and write most portable code?
Yes. At least Free Pascal is able to produce code that also runs on Win 3.11, MS-Dos, Atari and Amiga for example. Lazarus (read widgetset) is a bit harder for those (outdated) platforms.

If you separate the GUI from actual code it is always possible to easily add support for native GUI (if there is any available).

There is a wiki-page on multi-platform programming with FPC/Lazarus.

Quote
C++ or cpp  in bgi (Borland graphics interface?),
Yes that stands for Borland Graphics Interface. I would advice against using it although possible with FPC.

Quote
cpp in mfc (ms foundation class?)
Correct, not portable as it is windows only so requires a rewrite.

Quote
and cpp in something like owl (object windows library? (Borland or ms?)
owl is outdated, requires rewrite. Borland had support for that with Turbo C/Pascal for Windows.

Quote
Can you give me advice on some documents or web pages to read to port old code?
My advise would be to do a rewrite. The things you mention is really old stuff. that it isn't worth the effort. If you have more actual code that isn't tight to the GUI then you can ofcourse easily transfer that to Pascal code. GUI bits would have to be rewritten/redesigned (but that is easy to do with Lazarus RAD design).

Quote
c) would Lazarus be a better choice than python
In my personal opinion, yes. But i do not like python very much but i also use(d) TP/BP/Delphi for ages, so am a bit biased  :D

Quote
d) is javascript a better choice to do everything in a "browser application"?
No opinion on that subject other then to say that if that is your aim (run everything in the browser) that FPC/Lazarus might perhaps not be the best of choices.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #2 on: February 17, 2018, 05:58:01 pm »
As far as I know the new Macs are really a copy of an older Debian that Apple copied and made a few changes and some cosmetics layered on top and wrapped it up in shiny Apple paper and branded it as Mac OS.

In the time it took you to type that blather, you could have looked it up yourself:

https://developer.apple.com/library/content/documentation/Porting/Conceptual/PortingUnix/background/background.html#//apple_ref/doc/uid/TP40002848-TPXREF101


PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #3 on: February 17, 2018, 07:04:19 pm »
a) According to the faq it implies that Lazarus can even run on a Mac ( I assume if Max is running on Intel chipset only) As far as I know the new Macs are really a copy of an older Debian that Apple copied and made a few changes and some cosmetics layered on top and wrapped it up in shiny Apple paper and branded it as Mac OS.
At least Free Pascal is also is able to run on PPC powered macs. There is a mac portal on the wiki and MacOS X installation tips (which includes a compatibility matrix).

Here is a list of supported targets.

Lazarus itself runs on PPC Macs as well tough starting with 1.6 one needs to compile it oneself (I haven't tested 1.8 though, that's still on my todo list  ::) )
Quote
b) Does an Lazarus app / program run fast enough on a Mac, Linux and Windows.
Is it really mainly write one and compile and run it ok, as long as you do not too much "system" stuff. and write most portable code?
Yes. At least Free Pascal is able to produce code that also runs on Win 3.11, MS-Dos, Atari and Amiga for example. Lazarus (read widgetset) is a bit harder for those (outdated) platforms.

Amiga is also possible with the LCL  :D

Quote
d) is javascript a better choice to do everything in a "browser application"?
No opinion on that subject other then to say that if that is your aim (run everything in the browser) that FPC/Lazarus might perhaps not be the best of choices.

One can always use Pas2JS for this to keep using the same language.  ;)

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #4 on: February 17, 2018, 08:20:38 pm »
Lazarus itself runs on PPC Macs as well tough starting with 1.6 one needs to compile it oneself (I haven't tested 1.8 though, that's still on my todo list  ::) )
Ah, i did not know that. Thanks you very much for that share PascalDragon.

Quote
Amiga is also possible with the LCL  :D
Partially, yes  :D

There is this small hurdle that MUI itself uses auto-layout and has to be fought against. Default Amiga specs are too low for MUI let alone LCL  ;). Having an vampire (or good emulator here and here) makes it bearable though.

MUI designer in the makings  :)

One can always use Pas2JS for this to keep using the same language.  ;)
Ah cool, i did not realize that pas2js has matured so much already :thumbsup:

Julius7

  • New Member
  • *
  • Posts: 19
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #5 on: February 18, 2018, 10:04:07 am »
thank you everyone for your help and advice. I am glad to learn that there is an pas2js option.

For the js (java script) option, I am confused as to which file on https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/utils/pas2js/ I need.

OK maybe it is at https://svn.freepascal.org/svn/projects/pas2js/trunk/ there seems to be 3 files there such as Makefile

Makefile.fpc

fpmake.pp

Is this correct?

ths


Julius7

  • New Member
  • *
  • Posts: 19
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #6 on: February 18, 2018, 10:06:23 am »

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #7 on: February 18, 2018, 10:18:42 am »
You should not try to port  any old GUI code like BGI. Too much trouble, just write a new graphical interface. But all other code - properly separated - just runs....
Specialize a type, not a var.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #8 on: February 18, 2018, 11:43:56 am »
ps

I am referring to the page http://wiki.freepascal.org/pas2js#Where_to_get_it

Best use the snapshots provided in the same subsection.

Otherwise checkout FPC's trunk source and build using make clean all plus make install (this one maybe as root). Additionally you need the RTL for pas2js as noted here.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #9 on: February 18, 2018, 01:06:08 pm »
See https://github.com/tomboy-notes/tomboy-ng for a recently written app that compiles and runs from same codebase on Mac, Linux and Windows. A handful of ifdefs, some to cope with mac's idea of how Menus should be displayed,  but really, very little.

The mac build produces 32bit Carbon code right now but last time I checked, it did build under 64bit cocoa but had a few 'issues'.

For an app that is heavily GUI based, I'd strongly recommend FPC/Lazarus.

D
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

PascalDragon

  • Hero Member
  • *****
  • Posts: 5446
  • Compiler Developer
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #10 on: February 18, 2018, 09:31:41 pm »
One can always use Pas2JS for this to keep using the same language.  ;)
Ah cool, i did not realize that pas2js has matured so much already :thumbsup:
It has matured so much that TMS is using it for their new Web Core suite ;) (look especially at the demos at the bottom)

Julius7

  • New Member
  • *
  • Posts: 19
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #11 on: February 19, 2018, 02:48:18 am »
Sorry what and where is the MUI LCL widgetset  in Lazarus docs.
I am not getting it in the compiler help files, so I guess this is online in the wiki pages?

thks

js

Julius7

  • New Member
  • *
  • Posts: 19
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #12 on: February 19, 2018, 03:06:35 am »
I found a book on Amazon re cross platform
for cpp or c++
https://www.amazon.com/Cross-Platform-Development-Building-Windows-Applications-ebook/dp/B004VSLZ5G
... says "Cross-Platform Development in C++ "is the definitive guide to developing portable C/C++ application code that will run natively on Windows, Macintosh, and Linux/Unix platforms  "

however it seem the big issue going that way is the complexity and old thorn of "libraries" on different platforms.

So maybe I would be best just rewrite all the old code straight into Lazarus and just run only the simpler and purer C or C++ parts?

thks

Julius7

  • New Member
  • *
  • Posts: 19
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #13 on: February 19, 2018, 03:13:33 am »
so the LCL is referring to the GUI toolkit from Lazarus, the Lazarus Component Library?


molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Your thoughts on cross platform coding ie pascal, python and javascript
« Reply #14 on: February 19, 2018, 08:41:33 am »
One can always use Pas2JS for this to keep using the same language.  ;)
Ah cool, i did not realize that pas2js has matured so much already :thumbsup:
It has matured so much that TMS is using it for their new Web Core suite ;) (look especially at the demos at the bottom)
Ah yes, i noticed another thread recently that mentioned something like that  :)

I've also (just) noticed there is a separate mailinglist for pas2js... great... more (interesting) time to waste  :D Looking forward to that, thanks !

 

TinyPortal © 2005-2018