[Gambas-devel] Functions and subs

Fabien Bodard gambas.fr at ...176...
Tue Dec 8 14:57:27 CET 2009


in Fact the term of Function and Sub are VB inherited :/ ... since the
first GB1. There was the PROCEDURE keyword too ...

they are all the same for the interpreter ... it's just more clear to
say SUB whene it return nothing and Funtion in the other case.



2009/12/8 Kadaitcha Man <nospam.nospam.nospam at ...176...>:
> 2009/12/8 Ron <ron at ...572...>:
>
>> While checking my large codebase I have noticed that I had some routines
>> of type SUB that returned something  (SUB blabla () AS String etc) and I
>> have FUNCTIONS who don't return anything.... (ie no RETURN xxx or AS xxx
>> defined). Which is wrong of course.
>
> No, it's normal. You're not going to like this if you've had a few beers, mate:
>
> Functions return a value. Procedures do not.
>
> A procedure is a method that returns nothing, a subroutine.
>
> A function is a procedure that returns a value.
>
> BWAHAHAHAHAHAHAHAHA! Truly, no joke.

it's not funny man ... but an interesting query.

>
> If you don't know why I'm laughing it's because the implication is
> that a function is a subroutine that returns a value.

> You need to start thinking in terms of method and procedure, not Sub
> and Function. If you don't do that, when you actually read the Gambas
> documentation you'll be horribly confused as to why a procedure is
> documented as being a SUB.
>
> BUT WAIT! It gets worse. A method is a specific type of procedure.

hum, ... you must admit that some beginner don't know that ...

> Does that confuse and confound you much? It should.
>
> Sub and Function become superfluous when you start thinking in terms
> of method and procedure,
>
> ------------------------------------------------------------------------------
> Return on Information:
> Google Enterprise Search pays you back
> Get the facts.
> http://p.sf.net/sfu/google-dev2dev
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel
>




More information about the Devel mailing list