Recent

Author Topic: Heat from FreeBasic  (Read 31912 times)

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Heat from FreeBasic
« Reply #90 on: April 18, 2019, 04:19:38 pm »
I used procedural freebasic only. After checked it OOP I would say I'm wrong  :'(

FB has so much IDEs but most of them abandoned, only three keep going: WinFBE, PoseidonFB, VisualFBE. Community efforts is scattered, they never think about joining force to make something like Lazarus. There are many gui libraries only because there is no LCL, most of them are wrapper over winapi or porting existing libraries like gtk3, fltk... FB is more closer to C so generating such bindings is more easier than Pascal. The fact why Free Pascal doesn't have that amount of gui libraries because it has the LCL   :D

FB OOP style is not my taste. I don't say it not good but simply not my taste. I come from Java/Xtend/Fantom so I used to their OOP. Even Object Pascal I don't like and mostly use procedural programming  :(

FB OOP is not well suited for large scale projects, primarily due to the absence of null objects, meaning that as soon as an instance is declared, it is also immediately instantiated, including all nested objects firing every constructor on its way. It should be possible to do something like this:

Code: Pascal  [Select][+][-]
  1. dim obj as MyObject // declare instance
  2. obj = new MyObject() // instantiate and fire constructor

But it's not, and last time I had a discussion about this on the FB forum, the current developer(s) opinion was that an object should always point to something (should never be nil). I respect that opinion, but it prevents FB from reaching a higher level of professional programming.
« Last Edit: April 18, 2019, 04:23:18 pm by Munair »
keep it simple

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: Heat from FreeBasic
« Reply #91 on: April 18, 2019, 04:49:18 pm »
FB is all about mapping to C++, and C++ objects are like Turbo Pascal's, structs, not references.

While some are great proponents of this (if we forget said TP objects, it avoids the dichotomy of having separate records-with-methods and  a classes hierarchy), I think the price in constantly having to define and think about pointers and dereferencing in fairly basic code is not worth it.

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Heat from FreeBasic
« Reply #92 on: April 18, 2019, 05:24:51 pm »
FB is all about mapping to C++, and C++ objects are like Turbo Pascal's, structs, not references.

While some are great proponents of this (if we forget said TP objects, it avoids the dichotomy of having separate records-with-methods and  a classes hierarchy), I think the price in constantly having to define and think about pointers and dereferencing in fairly basic code is not worth it.

Not to C++, but to C. It is the reason why it is much easier to use GTK than Qt in FB.

Constructors exist for a reason and one should know what must happen upon instantiation. Admittedly, I had to get used to that years ago, but then I realized how much more control it gives the programmer when and where a (child) object should be instantiated and its constructor fired. I did this kind of programming a lot in REALbasic (which I believe was modeled quite a bit after Java). The language was heavily based on classes and did not even support structures until 2007 (counting from 1997).
keep it simple

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Heat from FreeBasic
« Reply #93 on: April 19, 2019, 12:59:59 pm »
No no I said when I launch a cli app from Lazarus on windows a console window immediately appear but on *nix nothing. It's because a mistake of laz dev.
No it is not.  As I've said this is a Operating System issue. On Windows there are "console applications" and "Win applications", on POSIX (i.e: GNU/Linux, GNU/Hurd, BSD, UNIX, AIX...) there are just applications, no matters if they're using the XWindow or not.

And there's a reason for that:  UNIX was designed to run in a distributed network, with a central node (mainframe) and a lot of small entry points (terminals).  The mainframe executes the application while the terminal just manages input and output, so the mainframe doesn't need a "console" and it pipes the input/outut streams to the network connection.  That's why Linux (and any other modern POSIX OS) uses the so called "Terminal Emulator" (although it is possible to use an actual terminal in an actual network or even in the same computer using localhost).

Windows was initially designed to work in a single computer without any distributed capability, so there were not need for such pipe mechanisms.  Recent versions allow some kind of distributed network, but limited and always through external libraries (not kernel services AFAIK).

And that's all I have to say.  Good bye, sir.
« Last Edit: April 19, 2019, 02:19:15 pm by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9870
  • Debugger - SynEdit - and more
    • wiki
Re: Heat from FreeBasic
« Reply #94 on: April 19, 2019, 01:14:01 pm »
No no I said when I launch a cli app from Lazarus on windows a console window immediately appear but on *nix nothing. It's because a mistake of laz dev.

As I (and I am one of the "laz dev") already stated: There is a setting that allows to specify a terminal. Then your app is going to be launched in a terminal as you expect.
This setting exists for IIRC over 10 years.

If you run without debug, you can use that setting. It works just fine.

But for some reason if you debug, then GDB (which is necessary for debugging) will not debug your app.  This is the reason why the setting is not active by default.

According to what other people say, there may be some terminals, on some versions of linux, which can be used, and with them gdb works. If you find one, you can use it.


If you or anyone knows, how to make that work with any terminal (or with most terminals), then please let us know. We really like to implement this. But we currently have no information how to do this.

And it may be, that other projects have managed to do this. But unless we know how, this is not helping.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: Heat from FreeBasic
« Reply #95 on: April 19, 2019, 02:08:53 pm »
FB is all about mapping to C++, and C++ objects are like Turbo Pascal's, structs, not references.

While some are great proponents of this (if we forget said TP objects, it avoids the dichotomy of having separate records-with-methods and  a classes hierarchy), I think the price in constantly having to define and think about pointers and dereferencing in fairly basic code is not worth it.

Not to C++, but to C. It is the reason why it is much easier to use GTK than Qt in FB.

I meant it as similar object model, i.e. default no refs, and RAII automatic initializations of objects if declared without pointer.  C has no objects, and certainly doesn't run initializers on structs.

I think you are thinking about really compatibility of the object models, which is something different again, I mean more design principles

giahung1997

  • Full Member
  • ***
  • Posts: 113
Re: Heat from FreeBasic
« Reply #96 on: April 29, 2019, 02:09:26 pm »
When looking to FB further I started to notice many quirks in the syntax.

Ex: Look at this example: https://www.freebasic.net/wiki/wikka.php?wakka=ProPgSharedLibraries
Is is more sane to move Export to the beginning: Export Public Function...?  :o

Free Pascal does have ; so it's easier to read, sometimes pure English like sentences not easy to read at all  :-*

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Heat from FreeBasic
« Reply #97 on: April 30, 2019, 10:38:52 am »
When looking to FB further I started to notice many quirks in the syntax.
I don't like any change to the syntax since QuickBASIC 4.5. All them looks very artificial to me. :(
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Heat from FreeBasic
« Reply #98 on: April 30, 2019, 10:46:46 am »
Nah, bad example... TurboBasic 1.0 (Robert Zale).... and TurboPascal 1.0... and UCSD Pascal....  and Burroughs CP/M Pascal and magazines with Commodore 16/64/128 assembler listings.. and Intel 4004 processors...that controlled nuclear bombs..... 8-) O:-)

(Quick Basic is  BASICA and yes, it is partially written by ....)


Bill Gates is also a - very good - programmer....People tend to not remember that.... ;D
« Last Edit: April 30, 2019, 10:51:34 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Heat from FreeBasic
« Reply #99 on: April 30, 2019, 11:29:07 am »
Nah, bad example... TurboBasic 1.0 (Robert Zale).... and TurboPascal 1.0... and UCSD Pascal....  and Burroughs CP/M Pascal and magazines with Commodore 16/64/128 assembler listings.. and Intel 4004 processors...that controlled nuclear bombs..... 8-) O:-)

(Quick Basic is  BASICA and yes, it is partially written by ....)


Bill Gates is also a - very good - programmer....People tend to not remember that.... ;D

QuickBASIC was not BASICA but it was developed from it. In QuickBASIC some important features were added, such as Types, DO..LOOP and WHILE..WEND constructs. QuickBASIC also disposed of line numbers, or rather, they became optional.
keep it simple

BobDog

  • Sr. Member
  • ****
  • Posts: 394
Re: Heat from FreeBasic
« Reply #100 on: May 01, 2019, 01:47:02 am »

You must remember that freebasic is not an ide driven compiler.
Ides like fbide or fbedit are by far the favourites, but notepad or gedit will suffice.
Also, fb can certainly utilize many external libraries, static or dynamic, but it does not hang on including libs for everything.
 In the main, popular external libs (like gmp, msvcrt, opengl, disphelper . . .) run smoothly.
Anything written in C has a head start in freebasic.
The OOP part of fb (like the rest of the language) is being developed.
fb has built in graphics (fbgfx, as a continuation from quickbasic), so it is appealing to many users for this alone.
I have been on the freebasic forum for many years, it certainly is a very easy language to use.







munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Heat from FreeBasic
« Reply #101 on: May 01, 2019, 08:10:59 am »
You may want to add Geany to the list. Install FB, write a BAS file in Geany, hit F8 and you have a FB compiled executable.  :D
keep it simple

munair

  • Hero Member
  • *****
  • Posts: 798
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: Heat from FreeBasic
« Reply #102 on: May 01, 2019, 08:16:25 am »

Anything written in C has a head start in freebasic.

That's because FB x64 is actually C under the hood. The FB compiler does not emit machine instructions directly but lets the C compiler do the job. FP is doing a much better job in this respect.

Personally I would favour a compiler that produces byte code for a VM that can run on any system. Much easier to maintain with only some performance cost.
« Last Edit: May 01, 2019, 08:19:09 am by Munair »
keep it simple

giahung1997

  • Full Member
  • ***
  • Posts: 113
Re: Heat from FreeBasic
« Reply #103 on: May 01, 2019, 08:22:05 am »

You must remember that freebasic is not an ide driven compiler.
Ides like fbide or fbedit are by far the favourites, but notepad or gedit will suffice.
Also, fb can certainly utilize many external libraries, static or dynamic, but it does not hang on including libs for everything.
 In the main, popular external libs (like gmp, msvcrt, opengl, disphelper . . .) run smoothly.
Anything written in C has a head start in freebasic.
The OOP part of fb (like the rest of the language) is being developed.
fb has built in graphics (fbgfx, as a continuation from quickbasic), so it is appealing to many users for this alone.
I have been on the freebasic forum for many years, it certainly is a very easy language to use.
What is the points you want to make here?
FB is definitely not easy to use et al, especially for people from C based lang like me. FB seemed to be a wordy version of C, use many words attempt to make the language looks easier like plain English but that's stupid. It do not work. Some syntax decision just plain ridiculous, like the export key word I mentioned in my last post. Too much words not make your language easier, as you could see the fallen of all Pascal like language: modula, oberon, component pascal... FPC was saved just because the need of a free delphi when the real one become ridiculously expensive. Hate it or not, the world has chosen C, the world has chosen curly braces because the victory of US based keyboard, it is short and easier to understand, especially if you are good at calculus, familiar with function defined by f(x) like most of people in the world. If German based keyboard was used international thing could be changed.

You like: int myfunc(int x, int y) or declare function myfunc(byval x as integer, byval y as integer) ?

The real heat from FB I mentioned is it growing mature of RAD IDE. New people and often clueless look for the hype basic is easy and go to it, when they used to it they will not look for anything other. You see, they only change from basic dialect, powerbasic to freebasic, but not to freepascal. That is what I want to tell all of you.

440bx

  • Hero Member
  • *****
  • Posts: 4032
Re: Heat from FreeBasic
« Reply #104 on: May 01, 2019, 08:43:28 am »
Personally I would favour a compiler that produces byte code for a VM that can run on any system. Much easier to maintain with only some performance cost.
That sounds like Java.  Its "some performance cost" is a bit on the high side but, that doesn't seem to have hurt it much.

ETA:

Hate it or not, the world has chosen C,
That is an indisputable fact.

the world has chosen curly braces because the victory of US based keyboard, it is short and easier to understand,
It definitely is short, as far as easy to understand, there are _mounds_ of unintelligible garbage written in C and C++.  Easier to write garbage with, definitely yes, easier to understand, only occasionally.


especially if you are good at calculus, familiar with function defined by f(x) like most of people in the world.
If you are good at calculus you don't appreciate the syntactic vagaries of the C language.

You like: int myfunc(int x, int y) or declare function myfunc(byval x as integer, byval y as integer) ?
You see, they only change from basic dialect, powerbasic to freebasic, but not to freepascal. That is what I want to tell all of you.
Some flavors of BASIC are definitely wordy.  Those who change from one flavor of BASIC don't choose Pascal or C because they want to switch to something that they have at least some familiarity with.  The familiarity factor is more important than power and portability (if it wasn't, they wouldn't use BASIC.)


« Last Edit: May 01, 2019, 08:55:52 am by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018