1st Time User Gambas Questions(Former VB6 user)

Lavos
Posts: 15
Joined: Sunday 28th July 2019 12:22pm

Re: 1st Time User Gambas Questions(Former VB6 user)

Post by Lavos » Wednesday 14th August 2019 11:00am

Lavos wrote:
Wednesday 14th August 2019 10:52am
cogier wrote:
Tuesday 13th August 2019 2:59pm
I have never used structs as Gambas says in capitals 'DON'T USE STRUCTURES, UNLESS YOU HAVE TO!'

What are you trying to acheive? Pehaps we can find an alternative.
Yes, that would be nice! I'll be sure to share when I find something out.
Cedron wrote:
Tuesday 13th August 2019 3:31pm
I've been busy for a little while so I have left this thread alone.

First a general comment for Lavos: I, too, am a long time VB6 (actually VB3-6) user and I found Gambas at the beginning of the year. My impression has been very very favorable. I see Gambas as a big improvement over VB6, sort of like VB done right. I joke it should have been called "Inc VB" (a word play on C++).

Having said that, there are a few things I would have liked to have been done differently. Foremost, is the lack of a line continuation character. I have requested it and it has been deemed too difficult to implement. I hope this is rectified in the future. I do find it a little annoying to have to dim all my variables, I would like to see either type declaration characters used (like VB), or a default type of Integer (instead of Single like orginal BASICs).

Those are the major ones.

Hitting the issues raised in this thread:

I much prefer having "Return (value)" rather than "(function_Name) = (value)" as the way to return values from a call. It would be nice to be able to return multiple values like Python can, but again, this has been deemed too difficult. Multiple values can be returned by either ByRef arguments (which are not the default like VB) or returning an object or an array. Unfortunately, this use of "Return" clashes with the "Return" used for a GoSub. I would have preferred a different word for the latter, perhaps "GoBack". The compiler can figure it out, but for readability I think different syntax should have been used. I am a huge fan of GoSubs and consider them one of the things that makes BASICs superior to other languages. Inherent readability being another.

The use of user defined structures is discouraged because I believe they make memory manager tougher, not sure about that though. There is difficulty in matching the packing rules between Gambas definitions and what an underlying language does (like C or FORTRAN external library calls), so structs may not match. I have never heard that it is poor programming practice to use a class when a struct would do. I am curious to what the motivation for that might be or where you have heard it.

Out of curiosity, who is your "community"?

Regards,
Ced
I'm relieved to see a fellow VB user on this forum, I can relate to your experiences and somewhat understand your opinions of comparing Gambas and VB. To answer your curiosity, people on other programming communities explain tests being done with comparing UDTs vs Classes, UDTs speeds are faster than using Class declarations according to my research from other forums, Jonathan S. Harbour said the same things with his books a while back, I forget which one was that though.

The community? I speak for those who are trying for an alternative to VB, the ones who are transitioning from Microsoft Windows to Linux. It seems like Gambas might be the answer.
Visit me in on my community "here"
Quincunxian wrote:
Tuesday 13th August 2019 10:46pm
There is a small issue with the Return statement when used with Try/Catch/Finally Error management.
In this example:

Try {some task}
Return {Result}
Finally
{Do some closing task}
Catch
{Handle Error}

In the case of no error occurring, the Return statement works as required but the Finally statement never triggers leaving any 'final' tasks undone. The Function essentially Quits as soon as the Return statement is met.

When you have error trapping in a Function it is better to do this:

Dim ReturnValue as {Required data Type}
Try {some task}
Return Value = {Result}
Finally
{Do some closing task}
Return ReturnValue
Catch
{Handle Error}
Thanks for sharing, I'll get right into playing around with this reference.

I wonder if there is a community-driven documentation for Gambas, some parts of it are so vague but i read it over and over again hoping i get something out of it... :(

User avatar
Cedron
Posts: 103
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

Re: 1st Time User Gambas Questions(Former VB6 user)

Post by Cedron » Wednesday 14th August 2019 1:36pm

Lavos wrote:
Wednesday 14th August 2019 10:52am
I'm relieved to see a fellow VB user on this forum, I can relate to your experiences and somewhat understand your opinions of comparing Gambas and VB. To answer your curiosity, people on other programming communities explain tests being done with comparing UDTs vs Classes, UDTs speeds are faster than using Class declarations according to my research from other forums, Jonathan S. Harbour said the same things with his books a while back, I forget which one was that though.

The community? I speak for those who are trying for an alternative to VB, the ones who are transitioning from Microsoft Windows to Linux. It seems like Gambas might be the answer.
Visit me in on my community "here"
Hmmmmmmmmm, classes being slower than UDTs has to be a platform/language specific thing. In theory, and in practice in many places, a class is simply a structure with an associated set of routines and the address of the instance implicitly passed as the first parameter. You can do it explicitly if you like, and I have many times, including recently when C was specified and C++ not allowed.

If you are looking for speed alone, Gambas is not the answer. It is is a byte code interpreter (like Python, Java, VB1-3, and optional in VB4). However, it is very easy to call shared libraries from Gambas which makes up for this. I have posted many examples of shared libraries in this forum, you may want to look at those.

I took a look at your community. I couldn't find any "About Eclipse Engine" to explain what it is about. My first thought was it had to do with the Eclipse IDE, but that does not appear to be the case. It looks like a game developers forum of some type.

If you are interested in using Gambas for game development, you might want to look at this thread:

https://forum.gambas.one/viewtopic.php?f=4&t=674

I also have a shared library for accessing gamepads that I have not posted yet.

Ced
.... and carry a big stick!

Lavos
Posts: 15
Joined: Sunday 28th July 2019 12:22pm

Re: 1st Time User Gambas Questions(Former VB6 user)

Post by Lavos » Monday 19th August 2019 7:35am

So I looked into this: http://gambaswiki.org/wiki/comp/gb.settings/settings and this seems like it could only handle form Objects... It's probably obvious for you guys where I'm trying to achieve here(Creating a database for the application to access files when needed.) So starting off, I'm trying to figure out how to create a .ini or .conf file to preset options to save for the user. Perfect reference is getprivateProfileString from windows if that makes any sense to you. I've never worked with XML before but it seems like it might be an alternative, any code examples of that would help.

I'm on a windows machine when i posted this, so any request of posting codes, i'd be happy too when i get to my linux machine.

-Regards, Lavos

Post Reply