[Gambas-user] Help inaccuracy or bug?

Benoit Minisini gambas at ...1...
Wed Apr 2 03:34:29 CEST 2008


On mercredi 2 avril 2008, Robert Rowe wrote:
> You are correct. I guess I'm too used to VB.Net. It adds the braces
> automatically.
>
> I guess the braces instruct the interpreter to return a value from
> methods while it returns a reference to the method if braces aren't
> used. there's always so much to learn when you start using a new language.
>
> It's starting to affect me the other way too. I've been writing in
> gambas at home so much that I'm starting to try to write gambas code in
> VB.Net at work. That doesn't work very well. :)
>
> Robert Rowe
>

Actually the braces are not mandatory if you use the method as a statement.

You can do:

MyTreeView.MoveNext

or

MyTreeView.MoveNext()

But you must do:

WHILE NOT MyTreeView.MoveNext()

The interpreter could deal with 'WHILE NOT MyTreeView.MoveNext', but I find it 
very confusing for the user: is MoveNext a property or a method ? 

I have an implicit rule in Gambas: a property is fast and light, while a 
method could be long and heavy. So the braces let the user see immediately in 
which case it is.

When using a method as a statement, it is not ambiguous, as a property cannot 
be a statement, except in an assignment.

Regards,

-- 
Benoit Minisini




More information about the User mailing list