Repurpose the Lazarus IDE

General FreeBASIC programming questions.
tcltkdev
Posts: 60
Joined: Oct 13, 2011 4:04

Repurpose the Lazarus IDE

Post by tcltkdev »

This just pop out of my head. Is it possible to for the Lazarus IDE to be used as FreeBASIC IDE (after modifying it to suite FB) since it is already complete. It has an extensive component library. This would really put FB in the mainstream/lime light. Just my 2 cents.
marcov
Posts: 3503
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Repurpose the Lazarus IDE

Post by marcov »

tcltkdev wrote:This just pop out of my head. Is it possible to for the Lazarus IDE to be used as FreeBASIC IDE (after modifying it to suite FB) since it is already complete.
Yes, in theory of course. For the basic IDE usage (not designer, not the various tools like intellisense that work with sourcecode, those parts are larger and more interweaved with Pascal than you might think, it would require a Basic equivalent of quite some Pascal features. At least some form of RTTI, method variables, class types and virtual methods)
It has an extensive component library. This would really put FB in the mainstream/lime light. Just my 2 cents.
Reuse of the component library (and the related designer) will be hard, it uses a lot of Pascal features (inheritance, RTTI, classtype variables (meta classes), exceptions and the rather unique class constructor system) that FB doesn't have afaik.

The component library uses many features of Object Pascal. Worse, they even had to extend C++ in BCB to support it. (and then it works only quite clumsily). In general reuse of OO components meant for a different compiler than what you are using is very hard.

Personally I wouldn't even try, but build something similar in FB, porting select code from lazarus to speed up if needed. Having something to mimic is always faster.
Last edited by marcov on May 15, 2012 10:28, edited 1 time in total.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Repurpose the Lazarus IDE

Post by TJF »

tcltkdev wrote:This would really put FB in the mainstream ...
IMO FB is allready in the mainstream. For cross-platform development (win32 / LINUX) I use
  • Geany IDE (extended by homebrew custom commands like FBeauty or h_2_bi)
  • Glade3 as GUI designer (GTK+ toolkit)
  • gettext for I18N / L10N
  • devhelp as help browser (FB docs and library docs, all-in-one)
  • fb-doc for documentation (combined with GTK-Doc or Doxygen)
What do you miss?
konaexpress
Posts: 6
Joined: Apr 11, 2012 17:40

Re: Repurpose the Lazarus IDE

Post by konaexpress »

TJF wrote:
tcltkdev wrote:This would really put FB in the mainstream ...
IMO FB is allready in the mainstream. For cross-platform development (win32 / LINUX) I use
  • Geany IDE (extended by homebrew custom commands like FBeauty or h_2_bi)
  • Glade3 as GUI designer (GTK+ toolkit)
  • gettext for I18N / L10N
  • devhelp as help browser (FB docs and library docs, all-in-one)
  • fb-doc for documentation (combined with GTK-Doc or Doxygen)
What do you miss?
No offense intended but if you have to figure out how to get all of those components to work together as a newbie so that you can develop in freebasic?......................yikes!

Just tell the guy the truth, freebasic is a hobby language. Yes, you can make some cool stuff with it but he might want to learn to use VB(windows) or Gambas(Linux) if he wants all the bells and whistles. The only other option as I see it is to get all the users to give up their code and libs so that everyone can use them and pick the best one(not going to happen).
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Repurpose the Lazarus IDE

Post by TJF »

konaexpress wrote:No offense intended but if you have to figure out how to get all of those components to work together as a newbie so that you can develop in freebasic?......................yikes!

Just tell the guy the truth, freebasic is a hobby language. Yes, you can make some cool stuff with it but he might want to learn to use VB(windows) or Gambas(Linux) if he wants all the bells and whistles. The only other option as I see it is to get all the users to give up their code and libs so that everyone can use them and pick the best one(not going to happen).
I see it vice-versa. Nobody needs all those components as a newbie. In Lazarus, vb or Gambas a beginner has to deal with all the bells and whistles in any way, at least to sort out an (for him) unneccessary feature.

In FB the environment grows with the users knowledge, beginning with an editor and the help system. When starting to use libraries, the help system grows and covers the new docs. When needing GUI, the designer gets added. And so on ...

In each step the user has to learn just one new component. It's not hard to get the components working together, the important knowledge for newbies is to select the right compoments from beginning on. Yes, FB starts as a hobby language and is also prepared for professional usage (with the focus on the hobby side).
tcltkdev
Posts: 60
Joined: Oct 13, 2011 4:04

Re: Repurpose the Lazarus IDE

Post by tcltkdev »

At work I'm a PowerBuilder developer since year 2000 and the only open source RAD tools that comes close to commercial products are Gambas & Lazarus Project. If I miss anything do mention it here. But I am comfortable programming in basic-like languages like PowerBuilder, VB.Net, FreeBASIC. As much as Lazarus is a very decent tool, I yet have to master it's syntax and component library.

That's why I was musing on the idea of repurposing Lazarus. It's no longer justifiable to forage and scavenge for code when there is limited time to develop a particular application and commercial tools offer rapid application capabilities.

.5% of my applications are written in FreeBASIC and exclusively console applications. I can develop from scratch an Invoicing program in PowerBuilder in a little as 2 hours. This would include database design and the development of user interface and invoice printing. I doubt if we could develop something this fast with existing open source tools without resorting to using a framework.

PowerBuilder is prohibitively expensive so I would not consider buying it for developing small applications that I would like to sell. Lazarus is the closest to being complete but again pascal is outside my present programming skill set and Gambas is a linux only and 99% of clients are Windows-based.
marcov
Posts: 3503
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Repurpose the Lazarus IDE

Post by marcov »

tcltkdev wrote:At work I'm a PowerBuilder developer since year 2000 and the only open source RAD tools that comes close to commercial products are Gambas & Lazarus Project. If I miss anything do mention it here.
Eclipse and Java being the main exception. But they are still clumsy with the designer.
But I am comfortable programming in basic-like languages like PowerBuilder, VB.Net, FreeBASIC. As much as Lazarus is a very decent tool, I yet have to master it's syntax and component library.

That's why I was musing on the idea of repurposing Lazarus. It's no longer justifiable to forage and scavenge for code when there is limited time to develop a particular application and commercial tools offer rapid application capabilities.
If you can't master Delphi syntax, then this endeavour is hopeless. You are talking about tens of manyears here.
.5% of my applications are written in FreeBASIC and exclusively console applications. I can develop from scratch an Invoicing program in PowerBuilder in a little as 2 hours. This would include database design and the development of user interface and invoice printing. I doubt if we could develop something this fast with existing open source tools without resorting to using a framework.
Lazarus had the disadvantage of being the first, without having free source code to convert (or copy wrt architecture). A FB based based clone would move much faster. Specially if it were GPL (and thus could reuse converted/modified FPC code directly)

But I think FB as compiler is not yet ready to start something like that. I would wait for some more features before starting a real large project.
  • proper base level of classes, including proper full polymorphism (virtual methods).
  • An easy as possible string type.
  • Some form of RTTI, to automated streaming of forms and components
  • a meta class type
The first is the biggest problem. The string type thing may be my own bias, and the RTTI too (generate code in separate files for it, as IIRC TJF said GTK does, could be a workaround for that).

The metaclass type is a requirement, but not necessarily in the form as Delphi/FPC have it. Maybe there are other solutions too (I actually don't know how C++ handles such cases).

WIth metaclass I mean separation of selection which class to create, and the moment of creation.

So

Code: Select all

  DIM animal AS Tmammal;

  switch (somevalue)
      case 1 :  animal=new Duck()
      case 2 :  animal=new Elephant()
      case 3 :  animal=new Pig()
Something like (note that the line that creates the class uses a variable, not a hardcoded class name)

Code: Select all

  DIM animal AS Tmammal;
  DIM animaltype as Class of TMammal;

  switch (somevalue)
      case 1 :  animaltype=Duck
      case 2 :  animaltype=Elephant
      case 3 :  animaltype= Pig

(lots of code here)

  animal=new Animaltype()
You need something like that for factory patterns, or in general to allow generic code (e.g. general purpose stream code and/or helpers) to create a class after looking up some identifier.

Besides this, for any kind of work with a large codebase (more than a couple of thousand) the compiler must be fairly rock solid, and codegeneration bugs must be very rare, and not GPF or internal error on every uncommon combination of functionality. I don't know how FB is on that road.
PowerBuilder is prohibitively expensive so I would not consider buying it for developing small applications that I would like to sell. Lazarus is the closest to being complete but again pascal is outside my present programming skill set and Gambas is a linux only and 99% of clients are Windows-based.
If you need something now, this is all academic. Building something is an multiyear (or a full lazarus clone a multi decade) endeavour with current development levels.

So that means the options are (1) the not so RAD use what's there route that TJF advocates (2) buy a commercial tool (Real Basic/PowerBuilder, or, as I did, Delphi) (3) use Lazarus.

P.s. I'm a Free Pascal developer and occasionally work on Lazarus too.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Repurpose the Lazarus IDE

Post by TJF »

FB is based on the GNU compiler suite. That means we can link to each library with an C API. A lot of libraries / headers are available. New headers or updates can be generated fast.
marcov wrote:But I think FB as compiler is not yet ready to start something like that. I would wait for some more features before starting a real large project.
  • proper base level of classes, including proper full polymorphism (virtual methods).
  • An easy as possible string type.
  • Some form of RTTI, to automated streaming of forms and components
  • a meta class type
The first is the biggest problem. The string type thing may be my own bias, and the RTTI too (generate code in separate files for it, as IIRC TJF said GTK does, could be a workaround for that).

The metaclass type is a requirement, but not necessarily in the form as Delphi/FPC have it. Maybe there are other solutions too (I actually don't know how C++ handles such cases).
FB may not be ready for this. But the libraries are:
marcov wrote:
  • proper base level of classes, including proper full polymorphism (virtual methods).
Use GLib types.
marcov wrote:
  • An easy as possible string type.
IMO the FB STRINGS are very powerful. In rare cases I use the GLib GString type.
marcov wrote:
  • Some form of RTTI, to automated streaming of forms and components
Create GUI-XML files with Glade3 and use GtkBuilder.
marcov wrote:
  • a meta class type
Use GLib type system.
marcov
Posts: 3503
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Repurpose the Lazarus IDE

Post by marcov »

TJF wrote:FB is based on the GNU compiler suite.
It is not. It uses it as C backend, which is something completely else.
That means we can link to each library with an C API. A lot of libraries / headers are available. New headers or updates can be generated fast.
Maybe. But for the sake of argument let's assume you can use most C stuff on Linux, and use those secondrate libs on Windows.

What was the point?
FB may not be ready for this. But the libraries are:
marcov wrote:
  • proper base level of classes, including proper full polymorphism (virtual methods).
Use GLib types.
If you can define glib polymorphic objects, and can use them straight for all intents and purposes, and without macro or casting trickery in FB, then you are right. (but I doubt it)
marcov wrote:
  • An easy as possible string type.
IMO the FB STRINGS are very powerful. In rare cases I use the GLib GString type.
I've no idea here actually.
marcov wrote:
  • Some form of RTTI, to automated streaming of forms and components
Create GUI-XML files with Glade3 and use GtkBuilder.
I might not want to stream to XML, but to some binary format to embed in the EXE. Otherwise I have to have a full blown XML parser in every exe for the most minimal thing.

Moreover, I already told you several times, I don't take GTK serious on Windows.
marcov wrote:
  • a meta class type
Use GLib type system.
See above. In general I name features needed for FB you name workarounds because FB lacks them. Something totally different.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Repurpose the Lazarus IDE

Post by TJF »

marcov wrote:
TJF wrote:FB is based on the GNU compiler suite.
It is not. It uses it as C backend, which is something completely else.
FB is based on the GNU assembler gas and the GNU linker ld. Late releases (>0.22) also have the C-emitter for gcc. Yes, we're speaking about totaly different topics. I talk about FreeBasic.
marcov wrote:If you can define glib polymorphic objects, and can use them straight for all intents and purposes, and without macro or casting trickery in FB, then you are right. (but I doubt it)
You doubt and I can. (The new GLib headers in version 0.24 are required.)
marcov wrote:I might not want to stream to XML, but to some binary format to embed in the EXE. Otherwise I have to have a full blown XML parser in every exe for the most minimal thing.
I haven't done this. But I'm sure it's possible to write a tool that uses GtkBuilder to parse the XML file in to memory and extracts the GUI tree from there to a file. That file can be embeded in the binary. (I'm not sure if I18N / L10N will be supported that way.)
marcov wrote:In general I name features needed for FB you name workarounds because FB lacks them. Something totally different.
Who needs features for FB when they're available in open source libraries?
marcov
Posts: 3503
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Repurpose the Lazarus IDE

Post by marcov »

TJF wrote:
marcov wrote:
TJF wrote:FB is based on the GNU compiler suite.
FB is based on the GNU assembler gas and the GNU linker ld.
(part of binutils, not GCC, so irrelevant)
Late releases (>0.22) also have the C-emitter for gcc. Yes, we're speaking about totaly different topics. I talk about FreeBasic.
Yes, but that is still not based on. THat is being able to use it. At arms length
marcov wrote:If you can define glib polymorphic objects, and can use them straight for all intents and purposes, and without macro or casting trickery in FB, then you are right. (but I doubt it)
You doubt and I can. (The new GLib headers in version 0.24 are required.)
We'll see what you come up with. (do the classic a duck quacks etc and with the separation of creation written above) But I bet it will be full of macro trickery and casts.
marcov wrote:I might not want to stream to XML, but to some binary format to embed in the EXE. Otherwise I have to have a full blown XML parser in every exe for the most minimal thing.
I haven't done this. But I'm sure it's possible to write a tool that uses GtkBuilder to parse the XML file in to memory and extracts the GUI tree from there to a file. That file can be embeded in the binary. (I'm not sure if I18N / L10N will be supported that way.)
I'm also sure that you can change GTKBuilder into Visual Studio if you work long and hard enough. But that does not make GTKBuilder Visual studio :-)
marcov wrote:In general I name features needed for FB you name workarounds because FB lacks them. Something totally different.
Who needs features for FB when they're available in open source libraries?
[/quote]

I haven't seen anything yet. Just the most god ugly macro and casting loaded code that I wouldn't touch with a ten foot bargepole.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Repurpose the Lazarus IDE

Post by TJF »

marcov wrote:We'll see what you come up with.
There's nothing to come up with.

I came up with these features in the all-in-one header for GTK 2.22. Meanwhile there were versions 2.24, 3.0 and 3.2. And meanwhile the glib-objects header is separated.
marcov wrote:Just the most god ugly macro and casting loaded code that I wouldn't touch with a ten foot bargepole.
When translating a C header one of my main targets is: the C documentation and the examples should be usable for FB as well. Meaning the FB source must be as similar as possible to the C source. ';'s removed, variable and function declarations addapted, that's it. So it's not up to me how the source code looks like.

BTW: C users and I can handle the resulting code, containing well documented macro and function calls. You can find hundreds of examples on the net. Maybe because we don't try to program with a bargepole.
marcov
Posts: 3503
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Repurpose the Lazarus IDE

Post by marcov »

TJF wrote:
marcov wrote:We'll see what you come up with.
There's nothing to come up with.

I came up with these features in the all-in-one header for GTK 2.22. Meanwhile there were versions 2.24, 3.0 and 3.2. And meanwhile the glib-objects header is separated.
I'm not asking for a anything GTK. I just want to see a simple example implementing objects with full polymorphisms en virtual. How workable the endresult looks. And if a not diehard user could think that up. (since we are talking about a RAD here, productive and easy)
marcov wrote:Just the most god ugly macro and casting loaded code that I wouldn't touch with a ten foot bargepole.
When translating a C header one of my main targets is: the C documentation and the examples should be usable for FB as well. Meaning the FB source must be as similar as possible to the C source. ';'s removed, variable and function declarations addapted, that's it. So it's not up to me how the source code looks like.

BTW: C users and I can handle the resulting code,
Yes, and assembler users can handle asm perfectly too. Still most people prefer HLLs, and even experienced assembler coders are faster with HLL. This is no different.

Doing it by hand with a lot of macro casting is possible but (much) more laboursome and errorprone. Just like asm is.

IOW like procedural is not ideal in asm, is OO not ideal (to put it gently) in procedural.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Repurpose the Lazarus IDE

Post by TJF »

marcov wrote:I just want to see a simple example implementing objects with full polymorphisms en virtual. How workable the endresult looks.
Fine.

As I said: take any C example, translate it to FB and use the new glib-object.bi header.
marcov
Posts: 3503
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Repurpose the Lazarus IDE

Post by marcov »

TJF wrote:
marcov wrote:I just want to see a simple example implementing objects with full polymorphisms en virtual. How workable the endresult looks.
Fine.

As I said: take any C example, translate it to FB and use the new glib-object.bi header.
"any"? I've never seen a clean C form of OO. Which is exactly my point.
Post Reply