[Gambas-user] Array.Sort

Benoît Minisini gambas at ...1...
Fri Jan 9 01:05:02 CET 2015


Le 09/01/2015 00:56, Lewis Balentine a écrit :
> On 01/08/2015 07:19 AM, Tobias Boege wrote:
>> Array.Sort() is a *method* :-)
>
> The basic (pun intended) elements of all OOP languages are classes
> constructed of properties and methods.
> --- you got me on that one
>
> In GAMBAS there seem to be several class methods defined that sometimes
> require parenthesis and sometimes do not. I was trying to
> determine/define the conditions that delimit when those parenthesis are
> required using familiar BASIC terms ... as in:
>       Public/Private Function  foo () as data type
>       Public/Private Sub  foo ()
> both of which I believe are appropriately considered methods in OOP
> languages.
>
> I believe my second formal computer class was MBASIC on a Osborn CPM
> computer (4 inch green screen). I am trying to recall if the term
> "Function" was defined in that language but those gray cells are no
> longer responding reliably. The other option was "Go to" that eventually
> evolved into "Public/Private Sub". At the time we called those
> "procedures".  I still call them "procedures" to distinguish them from a
> "function" that by definition is supposed to return something.
>
> Take a look at what I put in the WiKi and let me know if I should change it.
> http://gambaswiki.org/wiki/comp/gb/string[]/sort
> ... and if someone insists I will go back and change the variables to
> Hungarian notation but personally I find it more confusing than enlighting.
>
> Cheers,
>
> Lewis
>

It's simple:

You can omit the "()" at the end of function call statement only. It's a 
compiler shortcut that comes from Visual Basic.

I said "statement", not "procedure", because the interpreter makes no 
difference between a procedure (that returns nothing) and a function 
(that returns something) in the sense that it discovers that behaviour 
at runtime during the execution ; contrary to you, that knows that in 
advance.

Regards,

-- 
Benoît Minisini




More information about the User mailing list