Recent

Author Topic: Heat from FreeBasic  (Read 3469 times)

VTwin

  • Hero Member
  • *****
  • Posts: 620
  • Former Turbo Pascal 3 user
Re: Heat from FreeBasic
« Reply #15 on: April 15, 2019, 01:15:19 am »
I developed for decades using REALbasic (now Xojo) despite previous work in Fortran, Pascal, C, and C++, all languages I preferred. Why? Because it offered cross-platform development on Windows, Macintosh, and Linux, and a rapid GUI development environment.

After becoming extremely frustrated with REALbasic for numerous reasons, I researched the available options for a year or two. Java, Python, C++, etc. I finally decided on Free Pascal / Lazarus, and jumped in, converting 10s of thousands of lines of code.

A decade later, I'm still completely on board, no regrets. FreeBasic may be terrific at what it does, but is a non-starter for my needs in cross-platform rapid development. No bashing.
« Last Edit: April 15, 2019, 01:31:12 am by VTwin »
“Talk is cheap. Show me the code.” -Linus Torvalds

macOS 10.11.6: Lazarus 2.0.1 svn r60918 (64 bit Cocoa)
Ubuntu 18.04.2: Lazarus 2.0.0 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.0.0 (64 bit on VBox)

Munair

  • Sr. Member
  • ****
  • Posts: 415
  • Keep it simple.
    • Ditrianum
Re: Heat from FreeBasic
« Reply #16 on: April 15, 2019, 07:39:44 am »
I developed for decades using REALbasic (now Xojo) despite previous work in Fortran, Pascal, C, and C++, all languages I preferred. Why? Because it offered cross-platform development on Windows, Macintosh, and Linux, and a rapid GUI development environment.

After becoming extremely frustrated with REALbasic for numerous reasons, I researched the available options for a year or two. Java, Python, C++, etc. I finally decided on Free Pascal / Lazarus, and jumped in, converting 10s of thousands of lines of code.

A decade later, I'm still completely on board, no regrets. FreeBasic may be terrific at what it does, but is a non-starter for my needs in cross-platform rapid development. No bashing.

Almost exactly the same story here. REALbasic was powerful but support for Linux was limited and became quickly outdated. Only recently Xojo updated to GTK3. Especially Print support has always been bad on Linux.

Several years ago I also decided to use FPC/Lazarus for development on both Linux and Windows. It is currently probably one of the better options for cross-platform development in a high-level programming language, even though personally I find Pascal a little too verbose for my taste, which is probably due to its original intend to be an educational language.

For example, the following code in Pascal

Code: Pascal  [Select]
  1. while a < 6 do
  2. begin
  3.   writeln (a);
  4.   a := a + 1
  5. end;

versus

Code: Text  [Select]
  1. while a < 6 do
  2.   print(a)
  3.   a = a + 1
  4. end

in the language I'm currently developing for this very reason.
« Last Edit: April 15, 2019, 08:29:19 am by Munair »
Lazarus 2.0.0; Manjaro Linux; Windows 10 x64;

Handoko

  • Hero Member
  • *****
  • Posts: 2991
  • My goal: build my own game engine using Lazarus
Re: Heat from FreeBasic
« Reply #17 on: April 15, 2019, 08:29:39 am »
I learned programming started with BASIC. First time trying Pascal, I felt it was too verbose. But after using it for a while, I'm okay with it.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6940
Re: Heat from FreeBasic
« Reply #18 on: April 15, 2019, 09:55:15 am »
IMHO Free Basic and its community is better compared to the FPC 1.0.x series.

Before they went all C, they were quite like FPC in the early days (one of the reasons I've been monitoring them since 2006), but without a decent modular system (in that sense they were always very Cish. Probably because the QB crowd was used to stuff it in one big file)

However they allowed an external preprocessor from the start, and as an old Basic programmer (C=64, QB), I wouldn't recognize the average source posted on the FB forum nowadays as BASIC. It looks more like C with some leftover Basic syntax than the other way around.

Similar with the compiler. You need quite a deep knowledge of gcc and its libraries and windows incarnations to operate it, specially on WIndows.

FPC partially uses the same backends, but shields it much more, and more importantly, the unit system saves you simple linker and versioning errors in your own source too.

For a beginner, solving compiler/linker errors is often more difficult than the syntax of the language (something which many people obsess much too much about IMHO)
« Last Edit: April 16, 2019, 11:51:05 am by marcov »

kupferstecher

  • Full Member
  • ***
  • Posts: 240
Re: Heat from FreeBasic
« Reply #19 on: April 15, 2019, 11:14:23 am »
In my opinion, the more established non-C languages on the market the better for FPC. Because this reduces the pressure on programmers to stick to C-style-languages. Be it in a commercial or hobbyist environment. In the same way the decline of Delphi has a negative effect on FPC/Lazarus, that "movers" from Delphi to FPC can't compensate.

Thus I wish FreeBasic the very best.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6940
Re: Heat from FreeBasic
« Reply #20 on: April 15, 2019, 02:58:50 pm »
In my opinion, the more established non-C languages on the market the better for FPC. Because this reduces the pressure on programmers to stick to C-style-languages.

Unfortunately Freebasic compiles to C(read:gcc), so don't expect much independence there. There still is an assembler backend that recently even is getting a 64-bit variant, but on every problem you get told "use cgen" backend

Quote
Be it in a commercial or hobbyist environment. In the same way the decline of Delphi has a negative effect on FPC/Lazarus, that "movers" from Delphi to FPC can't compensate.

Thus I wish FreeBasic the very best.

I also wish them the best, and I'm still monitoring FB because I'm interested in the practical details of how the "compile-to-C" works out, just like I monitored GPC in the past how the gcc-frontend business worked out. But I no longer see them as something in the same lane or even direction as FPC.

kapibara

  • Hero Member
  • *****
  • Posts: 501
Re: Heat from FreeBasic
« Reply #21 on: April 15, 2019, 03:17:42 pm »
^All of you misunderstood so badly  :( and bashing me too much so i will run away... :'(

Please don't be a snowflake. :) https://www.youtube.com/watch?v=TaDqgDKORgU
« Last Edit: April 15, 2019, 03:23:31 pm by kapibara »
Lazarus trunk / fpc 3.0.4 / Debian Stretch 64-bit

Munair

  • Sr. Member
  • ****
  • Posts: 415
  • Keep it simple.
    • Ditrianum
Re: Heat from FreeBasic
« Reply #22 on: April 15, 2019, 03:21:02 pm »
FreeBASIC originally was meant to be a QuickBASIC clone, but it started late: 2004. It should have started in the early or mid 90s and it should have stayed away from C and stick to BASIC syntax. There also has never been a serious attempt by the FreeBASIC community to develop a (cross-platform) tool like Lazarus.

However, both FreePascal and FreeBASIC are limited if it comes to debugging. REALbasic was much more powerful in this respect. I believe that when a compiler is being developed, it should also be with debugging and ideally a (RAD) IDE in mind. Otherwise you'll get solutions like 20+MB size executables interpreted by third-party solutions, which work to only some extend. This too can get frustrating at times.
« Last Edit: April 15, 2019, 03:32:11 pm by Munair »
Lazarus 2.0.0; Manjaro Linux; Windows 10 x64;

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6940
Re: Heat from FreeBasic
« Reply #23 on: April 15, 2019, 03:49:28 pm »
FreeBASIC originally was meant to be a QuickBASIC clone, but it started late: 2004. It should have started in the early or mid 90s and it should have stayed away from C and stick to BASIC syntax. There also has never been a serious attempt by the FreeBASIC community to develop a (cross-platform) tool like Lazarus.

Not even underpinnings like FCL, or the classes units and its streaming system. In that sense they are not even in the same ballpark as 1.0. There is very few reusable libraries/framework outside the core distribution and the various IDEs.  The FB IDEs are much less a demonstration of general libraries as Lazarus was to FPC

The only part getting some attention seems to be fbgfx. Freebasic is more game oriented than FPC.

Quote
However, both FreePascal and FreeBASIC are limited if it comes to debugging. REALbasic was much more powerful in this respect. I believe that when a compiler is being developed, it should also be with debugging and ideally a (RAD) IDE in mind. Otherwise you'll get solutions like 20+MB size executables interpreted by third-party solutions, which work to only some extend. This too can get frustrating at times.

Open source debugging is simply cumbersome. This is a brick wall you are going to hit with any course.
« Last Edit: April 15, 2019, 05:10:34 pm by marcov »

440bx

  • Hero Member
  • *****
  • Posts: 747
Re: Heat from FreeBasic
« Reply #24 on: April 15, 2019, 05:02:47 pm »
Open source debugging is simply cumbersome. This is a brick wall you are going to hit with any course.
So true.  A versatile and capable debugging environment makes a big difference. 

I have to acknowledge the efforts of Martin_fr and the other folks who have worked and are working on the GDB interface for Lazarus, if any of you guys are reading this, you have done an impressive job, particularly considering that GDB isn't really all that friendly to languages other C/C++.

The success of a computer language is the sum of a lot of things.  A good debugging environment is one of them. 
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5259
    • wiki
Re: Heat from FreeBasic
« Reply #25 on: April 15, 2019, 05:17:32 pm »
As for debugging you may also start trying the new fp-debug. Still beta, but getting somewhere. (trunk or 2.0.2)

- Linux / Win Only 
  -- Technically Mac too, but you need to codesign the IDE (fp-debug server will solve that at some point)
  -- Mac actually use part of it, in the new lldb+fpdebug
- On win (pure fpdebug / not hybrid): debug target and IDE must have same bitness (64 bit IDE can only debug 64 bit apps // 32 bit IDE can only do 32 bit apps)
- No support for watchpoints (yet)
- stepping/breakpoints work. Small chances of issues if the debugged app is multi threaded
- watches should work except few types (no interfaces, function/method pointers, constants)
- expression in watches are still very basic.

It also exists as gdb hybrid, where fpdebug only does the watches. component/lazdebuggers/lazdebuggerFpGdbmi

Especially under windows (compiled with WithWinMemReader / happens by default).
Windows allows 2 debuggers to attach to one target. So fpdebug can read the memory without redirection via gdb. That makes watches a good deal faster.

Using gdb+fpdebug you can use dwarf3. This gives better results.

---
As for the elephant in the room: properties with getters.
Not yet. And it will be some time. It will need changes in fpc too. But it will eventually be possible.

---
Note, if you are on Windows 64 bit using GDB, and get the "step-over does step-in" issue. Go to tools > options > debugger: there is a property to enable a workaround.



Just to add Lazarus offers lots of debuggers
- GDB
- GDB server
- GDB over ssh
- GDB + FpDebug
- LLDB (even on win, if you have a working lldb / though current lldb for win have severe bugs)
- LLDB + FpDebug (same issues on win)
- FpDebug
« Last Edit: April 15, 2019, 05:31:48 pm by Martin_fr »

nanobit

  • New member
  • *
  • Posts: 22
Re: Heat from FreeBasic
« Reply #26 on: April 15, 2019, 05:34:56 pm »
Open source debugging is simply cumbersome. This is a brick wall you are going to hit with any course.

I don't think so. Debugging (generally interpreter-mode for many tasks) makes programming safer and MUCH less cumbersome.
That's why productive devs look first for debugging when they decide for a tool. Only benefits (fun factor, safety, competitive productivity, easy navigation).

Martin seems to have found a working recipe: gnu+fpDebug. It would already help, if fpc devs would support more dwarf 3 information.

giahung1997

  • Jr. Member
  • **
  • Posts: 66
Re: Heat from FreeBasic
« Reply #27 on: April 15, 2019, 05:48:14 pm »
What do you think about basic256? First sight I think it's the language for kid but when looked throughout the document I saw it rather complete (in it own sense) with not only drawing function which is the traditional strength of basic but also good and simple regular expression.

Is there anything equivalent in free pascal can do  like the example on this page with ease?

http://doc.basic256.org/doku.php?id=en:explode

My way is traditional for loop  ;)
« Last Edit: April 15, 2019, 05:57:10 pm by giahung1997 »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 6940
Re: Heat from FreeBasic
« Reply #28 on: April 15, 2019, 05:51:30 pm »
I have to acknowledge the efforts of Martin_fr and the other folks who have worked and are working on the GDB interface for Lazarus, if any of you guys are reading this, you have done an impressive job,

Definitely, and a horribly thankless job.

Quote
particularly considering that GDB isn't really all that friendly to languages other C/C++.

They have the same problems, but it is less noticable because a few core language are developed in lock-step with GDB. Once you e.g. stick to older versions or if your language gets dropped from the core (e.g. because they switch the VM that they track (Python, Java)) then you are in shaky territory again.

Why? Interfaces are not fixated.

And on Windows it is always one step away of disasters, since the gcc toolchains there are permanently confused about going for native windows solutions, or take the easy way and implement some posix/linux emulation. (hence the various thread models of 64-bit gcc, already mentioned in this thread)



Handoko

  • Hero Member
  • *****
  • Posts: 2991
  • My goal: build my own game engine using Lazarus
Re: Heat from FreeBasic
« Reply #29 on: April 15, 2019, 06:02:39 pm »
Is there anything equivalent in free pascal can do  like the example on this page with ease?
http://doc.basic256.org/doku.php?id=en:explode
My way is traditional for loop  ;)

Something like this below?

Code: Pascal  [Select]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   Data       : string;
  4.   ResultData : TStringArray;
  5.   i          : Integer;
  6. begin
  7.   Data := 'We all live in a yellow submarine.';
  8.   ResultData := Data.Split(' ');
  9.   for i := Low(ResultData) to High(ResultData) do
  10.     ShowMessage(ResultData[i]);
  11. end;