OOP: If not now, when?

General FreeBASIC programming questions.
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

FB will always remain free, don't worry, the names says it all, the "Free" it's not only as in "freedom/libre" but as in "as-beer/gratis".

OO will be a bit easier to implement when the GCC frontend move is done, because then we can reused the GCC's mangling routines without too much trial-and-error attempts or taken non-official docs into account, and also reuse it's pre-made multi-platform exception handler.

Internally FB must follow the C++ ABI or nobody will be able to use any C++ libs compiled with GCC ever, unless somebody wrap them, what could take ages. Also because GDB (the debugger) is pretty dependent on the C++ ABI, not been able to debug OO applications would make it almost useless.
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Post by anonymous1337 »

Yeah, V1c you've been answering a thread like this about once every week it seems :D Good job!

I knew something had to be complete before you start on OO. ^_^;; I just forgot what. Eh, guess I needed another copy of this thread as well. Just need a reminder every now and then.
etko
Posts: 113
Joined: May 27, 2005 7:55
Location: Slovakia
Contact:

Post by etko »

May I ask in what status is GCC ABI migration right now?
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

Well, integrating a 60K LOC project into a 400K one when both are completely procedural/imperative and when the official documentation is missing and the non-official one is outdated because the internal interfaces were completely changed and you have to hack yourself the other (not really commented) 100K LOC front-ends to find what should be done.. you get the picture.

The GCC's pseudo garbage-collector done on its tree nodes doesn't help either, a helper module written in C will be needed because of that.

But at least i won't have to deal with high-level optimizations that took one decade and thousands of testers to get done, neither write new emitters to other cpu's, there are dozen of them to use right now if the rtlib is ported too. Also cross-compilation will become easier, if you can stand waiting 50 minutes to GCC build itself 3 times :).
etko
Posts: 113
Joined: May 27, 2005 7:55
Location: Slovakia
Contact:

Post by etko »

May I ask which one project is FB? I guess that 60K LOC one.
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

GCC's SSA optimization module alone is bigger than the whole FB project.

The 60k LOC are for the compiler only, rtlib and gfxlib have over 40k LOC that must be updated too to support cross-compilation - the build process will have to move to autoconf and automake.
etko
Posts: 113
Joined: May 27, 2005 7:55
Location: Slovakia
Contact:

Post by etko »

Wouldn't this merger with GCC be disatvantage? Right now fb is quite small but later it may become bloated. As GCC is :).
marzec
Posts: 225
Joined: Jun 06, 2005 23:17

Post by marzec »

if you think gcc is bloated then have a look at vc.net
jofers
Posts: 1525
Joined: May 27, 2005 17:18

Post by jofers »

"quite small"? FB takes up over 40mb on my computer :D GCC is a little bigger, but not that much considering how much more is included with it.
yetifoot
Posts: 1710
Joined: Sep 11, 2005 7:08
Location: England
Contact:

Post by yetifoot »

if you think gcc is bloated then have a look at vc.net
yeah, i just ignore programs that want the .net runtime. i just cant be bothered with that download. Its going to have to be a very very good program that makes me download it.
Fausti
Posts: 32
Joined: Sep 26, 2005 21:33

Post by Fausti »

Integrating OOP into fb would be really cool, but we should be patient and wait :)

Victors way will take longer than doing something like FB only OOP (something like in D, there the D classes aren't compatible to C++ classes, so they have to be wrapped), but we will really gain all the possibilities gcc offers (as far as I know, you can write for example something in freepascal, use the gcc frontend to compile it and use it with your C code, or even use it with your D code).

And if someone really can't wait, than someone could use/write a preprocessor, that uses fb's possibilities to simulate OOP. That means parsing your code and changing templates/classes & co. into normal basic code to compile. But the coder won't even notice this extra step. All the OOP stuff would be handled by the preprocessor.
rmann05
Posts: 50
Joined: May 31, 2005 16:02
Location: Florida
Contact:

FreeBasic and GCC

Post by rmann05 »

When FreeBasic is converted to use GCC, will Windows users have to download the GCC package?
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

Nope, the libraries, include files and external tools will still the same as now, just fbc.exe will be modified and yeah, it will be almost 9x bigger than now (about 4mb), but that's a small price to pay to be portable to dozen of different platforms and have optimizations that no other BASIC ever had - neither VB6 using the VC++ back-end.
duke4e
Posts: 717
Joined: Dec 04, 2005 0:16
Location: Varazdin, Croatia, Europe
Contact:

Post by duke4e »

english is not my native language, so i don't fully understand some things, so i want to clear them out.
if i'm getting the whole thing around FB and GCC, the coder will write a program using FB syntax and then FB will translate it, so it can be compiled with GCC.

am i right? if not, can someone tell me what's all this stuff around GCC?
VirusScanner
Posts: 775
Joined: Jul 01, 2005 18:45

Post by VirusScanner »

I think it's just going to use the GCC backend, which means that code is translated into different structures and then fed into GCC, which emits assembly code for it. But fbc won't emit C code, or even asm code for that matter, the GCC backend would do it.

I may be wrong though.
Post Reply