[Gambas-user] Suggestions 4 new keywords
Rolf-Werner Eilert
eilert-sprachen at ...221...
Fri Sep 17 08:51:59 CEST 2010
I think this could lead to misunderstanding if you keep the BASIC
concept of "free" indention:
> But if you want less keywords, you can do:
>
> PUBLIC '(a.k.a. Interface)
> Age AS Byte
>
> setAge(Value AS Byte)
> IF Value>= MinAge AND Value<= MaxAge THEN Age = Value
> END
>
> Because, I think than, a method (procedure or function) is defined by
> its signature, not by the prefix keywords FUNCTION, PROCEDURE or SUB.
>
> May be, you want to do optionals these keywords.
>
I can understand what you mean, but it's true what was said here
earlier: Just imagine a few hundred codelines instead of these 3 in your
example - at the end of the procedure (where your END stands) you maybe
wouldn't know by heart if there was a PUBLIC somewhere or whatever.
If you want to get rid of the "bracketing" the keyword SUB does, you
should either provide an intelligent editor which presents this piece of
code as one piece (some color or whatever), or you come to a concept of
indention like - what was it, Ruby?
But if you really want to get rid of something useless, why not change
SELECT CASE into SELECT? I don't know the history of this keyword, but
it smells like it was planned to allow for further combinations.
However, nobody ever implemented them, and it stayed as it was. If we
don't revive the old idea, why not allowing the programmer to write it
like SWITCH? You could make it an option:
SELECT myExpression
CASE 0
CASE 1
CASE 2,3
CASE ELSE
END SELECT
Regards
Rolf
More information about the User
mailing list