The power of GLBasic !

Previous topic - Next topic

SnooPI

I take a moment to thank Gernot, I'm testing a lot right now the INLINE function, DLL and the interaction between the GLBasic and the C, and that's great.
All functions and variables of GLBasic can be used directly in C (I already knew it but I had never really tested it, it's amazing of ease).

I even wonder if a version of Basic reserved for Windows (using DirectX) would not be a good idea.
A future DXBasic?

You did an amazing job Gernot, I congratulate you  :good:

Sorry if my English is not perfect, it's hard for me, a lover of the Basic and the C since a long time (a little less for the C++ it's right  =D) to explain that with the good words in english.

bigsofty

Yup, totally agree! I'm continuously reminded how well GLBasic syntax has been designed. Its as complex as you want, yet simple enough for first time coders. Optional inline C, is such a valuable feature too, I am amazed that none of the big-boys (Unity etc.) have it as a feature!  :happy:
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

SnooPI

#2
Yes, It's became my main language.
For windows, there is no real limit

I just started a wrapper for an old (but cool) 3D DirectX engine, the interaction between GLB and C is totally awesome.
I feel like I can do what I want, it's exhilarating.

Moru

Yes, GLBasic is great! The reason the big guys don't use BASIC as a language is largely because of the (undeservedly) bad reputation it has.

kirkdev

I agree GLBasic is alot of fun. I can why it would have a bad reputation with features such as GOTO. Most languages adapt but BASIC seems to remain static in design. Removing GOTO and updating types to work similar to c++ structs would increase program design while keeping its simplicity.
Kirk

MrPlow

I agree - I wrote a medium article on BASIC, but specially on older 80s BASIC...etc. etc.
But same applies - people forgetting that BASIC is where it started for a lot of coders.
I really enjoy using GLB

Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

SnooPI

Quote from: Moru
..The reason the big guys don't use BASIC as a language is largely because of the (undeservedly) bad reputation it has.

Absolutely, but I think that has really changed in recent years (at least I hope so).

kirkdev, personally, and I think it's the same for others, we almost never use GOTO, only when we do not want to get tired  ;)
By the way, kirkdev, I see you're new, so I welcome you!  :booze:

MrPlow, I allowed myself to put a link to your article (you say if it bothers you).
https://blog.usejournal.com/why-80s-basic-still-matters-1c17de5768fa

kirkdev

Thanks for the warm welcome Snoopy  :good:

It's more than likely the case now days that people are not using GOTO. Another reason why BASIC's popularity might have been impacted is due to OOP and other "modern" features and tools. Look at JavaScript for example, it's more popular than ever, yet it has changed and adapted with demand.

I have used BASIC on and off for 15 years or so and it's always refreshing and fun. Just trying to tell myself that it's okay that every function is global and come up with some decent names for symbols.  =D

Kirk

dreamerman

GoTo is here rather to have compatibility with some older Basic programs, like for example porting from QuickBasic, but in today more like OOP style it isn't advised.
From what I know 'bad reputation' of Basic's started in 8/16bit era, and it significantly increased with Windows due the QuickBasic and later Visual Basic. It was so easy to play with simple commands, and this encourage people to learn programming. QuickBasic was a big thing for amateurs/home enthusiast, it showed that you don't need to buy top-end PC and expensive C compiler to write something (as generally Basic's were interpreted not compiled so instant run&test and You know, that was bad for some companies :D) Of course there were many other tools (ASM, Pascal) but none of them so easy to use.

There are some really interesting stories about Basic, for example thing about 'build engine' that's powering Duke Nukem 3D, Blood..
Quote from: Ken Silverman author of 'Build Engine'I first develop algorithms in QuickBasic because it has a great debugger. When I'm satisfied, I then port the code to C. The final step is converting some critical parts of the C code to assembly.
And he is using a lot of GoTo there ;)


btw. kirkdev You can use OOP and have hidden functions accessible through custom UDT..
Check my source code editor for GLBasic - link Update: 20.04.2020

kirkdev

Quote from: dreamerman on 2019-Apr-25
btw. kirkdev You can use OOP and have hidden functions accessible through custom UDT..

:o tell me more... Is this in the help documentation? I played around trying to add a function to a type but must have been doing it wrong as I got a compiler error and assumed it wasn't a feature.

Funny how C compilers are mostly free and some BASIC compilers are not. Not that I mind, I'd much rather support the development of a product knowing that it won't just be dropped.

Kirk

dreamerman


It may be somewhere in help file but I'm not sure, yet on forum there is plenty of examples, just not marked specificly as OOP.
Simple example how to use function in types:
Code (glbasic) Select

TYPE point2d
x%
y%
ENDTYPE

TYPE point_str
pos AS point2d
FUNCTION init%:
self.pos.x% = RND(10)
self.pos.y% = RND(10)
ENDFUNCTION
FUNCTION move%: dx%, dy%
INC self.pos.x%, dx%
INC self.pos.y%, dy%
ENDFUNCTION
ENDTYPE


GLOBAL i1%, tx%, ty%, points[] AS point_str
DIM points[10]
FOR i1% = 0 TO 9
points[i1].init()
DEBUG "point " + i1 + ", pos: " + points[i1].pos.x + "x" + points[i1].pos.y + "\n"
NEXT

tx% = RND(5) - 2; ty% = RND(5) - 2
DEBUG "vector: " + tx + "," + ty% + "\n"

FOR i1% = 0 TO 9
points[i1].move(tx, ty)
DEBUG "point " + i1 + ", pos: " + points[i1].pos.x + "x" + points[i1].pos.y + "\n"
NEXT

So You can have for example math library and use it to calculations like this;
value% = Math.something(arg1%, arg2#)


About Basic's, yeah, whole industry changed a lot since then, there was many more commonly used compilers than now - Borland, Watcom, Digital Mars...
Love is only one, Basic.. :)
Check my source code editor for GLBasic - link Update: 20.04.2020

kirkdev

Thanks for the example. I will go and refactor my project with this goodness.  :good:
Kirk

SnooPI

True programmers use ASM, C or both  =D (and now GLB+C  8))
The object-oriented programming possibilities used in GLBasic are sufficient.
I hope GLBasic will always keep this particularity and will not try to look like other so-called "moderns".
If some want more, they can create C++ with the Inline function.