[Gambas-user] Better use of prefixes

Cedron Dawg cedron at exede.net
Sun Mar 17 18:43:30 CET 2019


Okay, thanks.

If it weren't for the need for the compiler to know the type of variable "Dims" wouldn't be necessary.  That's why I used to use type declaration characters in the BASICs where they were available, they render the Dims unnecessary and tell you the type in a compiler rather than convention enforced way.  Obviously, with more types available that kind of falls on its face.  The compiler could be written to use Hungarian notation in the same way, and that would for sure enforce as standard set of abbreviations.  (That is not a suggestion, BTW, I think that would be awful.)

In a lot of languages, the variable allocation statements, have to come before the code execution.  This restriction comes from having one pass compilers where the data area needs to be laid out before the machine code starts being written.  I hope we have come a long way from that.

Putting them at the top of a routine, like you prefer, let's you see all the variables that a routine uses right away.  I don't see a big need for that.  If you consider my little section markers as dividing a routine into a set of tasks, for lack of a better word, then I like to place the dims at the top of the Task, not interspersed in the syntax itself.  So we are kind of in agreement.  For me, I will want to reference the Dim statement when I want to find out the specific type of a variable, thus having it closer helps.  That is in Gambas (or VB).

In C++, I have no problem doing for( int i = 0, i < n; i++ ) and declaring it right next to the usage.  C doesn't allow this.  One of the annoying little differences between the two.


----- Original Message -----
From: "Cristiano Guadagnino" <criguada at gmail.com>
To: "user" <user at lists.gambas-basic.org>
Sent: Sunday, March 17, 2019 1:16:53 PM
Subject: Re: [Gambas-user] Better use of prefixes



I am curious what you mean by "Displacement of Dims". 



Moving DIMs from the top of the sub/function to another place. In your words: "Moved dims closer to their usage". 

Cris 


----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]---- 



More information about the User mailing list