Recent

Author Topic: Silly question  (Read 7255 times)

giahung1997

  • Full Member
  • ***
  • Posts: 113
Silly question
« on: June 07, 2019, 09:50:38 am »
Anyone ever think about something like LCL-Swing or LCL-JavaFX or LCL-Winform or LCL-WPF? As we already have LCL-Win32, LCL-Qt, LCL-Fpgui... Is it true if we have, for example, Java interop so we can have LCL-Swing, isn't all of the custom controls developed for Swing by third party could be immediately usable for us in addition to the standard LCL controls? I saw a neat custom controls set for Swing and I'm wonder if it so  :D

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Silly question
« Reply #1 on: June 09, 2019, 04:05:43 am »
In theory, it could be done. But that's as far as I would ever think of. You're adding a bunch of runtime execution dependencies for tiny (if any) benefit. Swing ain't no light widgetset, it's a fully custom drawn one and thus, very heavy. While after having LCL backend for it you can use that custom control, it's limited to that backend, no other widgetset would be able to use it. OTOH, porting the custom control to LCL would be a more beneficial move, especially if you can make it without depending on any specific widgetset functionality and solely rely on existing LCL features, the control would be directly compilable and useable on all existing widgetsets.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: Silly question
« Reply #2 on: June 09, 2019, 12:45:32 pm »
Someone from this forum did something similiar vcl4java . You can write java programms in freepascal with using lcl and fcl.
It looks like he dropped this project too.

giahung1997

  • Full Member
  • ***
  • Posts: 113
Re: Silly question
« Reply #3 on: June 19, 2019, 03:54:22 pm »
Someone from this forum did something similiar vcl4java . You can write java programms in freepascal with using lcl and fcl.
It looks like he dropped this project too.
It seemed a day I could use swing component in Lazarus is very far faraway  ::)

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Silly question
« Reply #4 on: June 19, 2019, 04:13:26 pm »
.... Is it true if we have, for example, Java interop so we can have LCL-Swing, isn't all of the custom controls developed for Swing by third party could be immediately usable for us in addition to the standard LCL controls?

It rarely works that way.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Silly question
« Reply #5 on: June 19, 2019, 04:22:26 pm »
If you know Java, If you know ppcjvm and its tools this is perfectly possible.
Just do not expect to be able to use a visual designer from the Pascal side.
ppcjvm is actually pretty powerful and there are tools to create the bindings.
Jonas made an excellent effort here.

Sometimes I think I am the only one actually using it......
I would recommend it to everyone on the forum with some basic Java knowledge.
« Last Edit: June 19, 2019, 04:24:32 pm by Thaddy »
Specialize a type, not a var.

giahung1997

  • Full Member
  • ***
  • Posts: 113
Re: Silly question
« Reply #6 on: June 19, 2019, 06:16:40 pm »
.... Is it true if we have, for example, Java interop so we can have LCL-Swing, isn't all of the custom controls developed for Swing by third party could be immediately usable for us in addition to the standard LCL controls?

It rarely works that way.
So my idea is not only silly but will also not work.  It should be that straight forward so people could just skip this thread and invest more on the existing bindings  ;)

giahung1997

  • Full Member
  • ***
  • Posts: 113
Re: Silly question
« Reply #7 on: June 19, 2019, 06:19:25 pm »
If you know Java, If you know ppcjvm and its tools this is perfectly possible.
Just do not expect to be able to use a visual designer from the Pascal side.
ppcjvm is actually pretty powerful and there are tools to create the bindings.
Jonas made an excellent effort here.

Sometimes I think I am the only one actually using it......
I would recommend it to everyone on the forum with some basic Java knowledge.
I don't know Java that much. Use it as a dumbed down C++ for online competition exercises (the easy to solve ones  :P) I can. More advanced concept like Generic or Annotations I will stuck  :)

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Silly question
« Reply #8 on: June 19, 2019, 06:40:54 pm »
Java is not dumbed down C++ because C++ is impossible to dumb down....
(And I hold a Borland trainer certificate for C++.... See...)

C++ or FPC are very powerful in the right hands, never blame the language, blame the programmer.
Java prevents C++ programmers to make many obvious mistakes..... Pascal needs such a substitute language far less....If ever...
Think!
« Last Edit: June 19, 2019, 06:52:43 pm by Thaddy »
Specialize a type, not a var.

giahung1997

  • Full Member
  • ***
  • Posts: 113
Re: Silly question
« Reply #9 on: June 19, 2019, 07:27:10 pm »
Java is not dumbed down C++ because C++ is impossible to dumb down....
(And I hold a Borland trainer certificate for C++.... See...)

C++ or FPC are very powerful in the right hands, never blame the language, blame the programmer.
Java prevents C++ programmers to make many obvious mistakes..... Pascal needs such a substitute language far less....If ever...
Think!

Oops. I didn't blame any language. I don't like Java because it had me write too much, too verbose, the same problem with Object Pascal. I use a scripting language with dynamic type and very short syntax to write my code. Then convert it to Java to upload to the online test site for them to check it. My algorithm sucks and slow but it usually just works. Of course my rank is low  :)

I want to use Lazarus because of this community, who will guide me even the basic newbie level code. I lacked formal education of computer science so this will very helpful  :)

Of course when I get the code working I will convert it back to my favorite scripting language. I only write serious code with the language I feel comfort with. If I care about performance I could just skip fpc and go straight to C++. Sometime, fpc compiled binary performance even lose to java, measured with unix time command  ::)

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Silly question
« Reply #10 on: June 19, 2019, 09:52:15 pm »
Sometime, fpc compiled binary performance even lose to java, measured with unix time command  ::)
It takes writing a pretty lousy algorithm to accomplish that.

it had me write too much, too verbose, the same problem with Object Pascal.
It's usually a lot faster to type a few additional characters than looking for, and fixing, a bug caused by the succinctness of the language (or its "so convenient" garbage collector that decided that one of your variables was garbage....oops!)



I lacked formal education of computer science so this will very helpful  :)
Potentially, it could be very helpful.  For help to be helpful, the receiver has to listen.  Without that, it won't have any effect at all.  The good news is the same as the bad news: it's up to you.




(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

giahung1997

  • Full Member
  • ***
  • Posts: 113
Re: Silly question
« Reply #11 on: June 21, 2019, 03:17:56 am »
@440bx:

1. Sorry. I have not compiled with optimization. Compiled binary is as fast as Java  :-[

2. Only if you don't use an IDE. It will catch and show warnings immediately  :)

3. I will listen what really helps me and skip other parts  8-)

 

TinyPortal © 2005-2018