[Gambas-user] Another syntax sweetness question and request
Cedron Dawg
cedron at exede.net
Wed Mar 6 22:26:38 CET 2019
No synonym called "Method"? You have to be careful not to slip down the slippery slope to #define hell. Where every maintainer who follows you has to not only try to figure out your organizational structure, but also has to go hunting down the definitions of your "language extension".
Do a search on "Obsfucate C".
I'm going to stick with sub for them all since as you point out, "function" without a return value is kind of meaningless. The kludge of calling it void is ugly too. One of the best features of BASIC is what it was designed for, a friendly face on FORTRAN, i.e. a language which is ideal for a first language. Hitting a new learner with a bunch of options, with no great gain from it, seems to me to be undesirable.
----- Original Message -----
From: "Tobias Boege" <taboege at gmail.com>
I personally use Function for pure functions, that take input and return
a value without affecting or being affected by state of the current object.
I use Sub for subroutines in the sense that they execute code that might
modify state but don't necessarily return a value. So in my code you'll
never see "Function" without "As", but you will see "Sub" with or without
"As". What I don't use is the third synonym "Procedure". (Maybe I should
employ that for "Sub that doesn't return a value"?)
> Request:
>
> Would it be possible to make subs return multiple values like Python can?
>
> That can be really handy.
I second that. Meanwhile you can emulate this through ByRef. It isn't pretty
but IIRC the way ByRef is implemented could be used to make subroutines
return multiple values. That requires a new syntax for a "tuple L-value"
though.
Regards,
Tobi
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
More information about the User
mailing list