[Gambas-user] variable declaration everywhere ???

Bruce adamnt42 at gmail.com
Fri Dec 14 13:04:33 CET 2018

Well, lets just get out of the box here (or outside the nine dots, if 
you get my idea)

On 12/12/18 9:59 am, Jussi Lahtinen wrote:
> Aesthetics or practical issue?

(BTW, I just picked this as a rational point in the thread.)

The only cogent argument that has been presented by the entire brains 
trust here is that it would be handy, really handy, to be able to 
"declare indexers for an array loop on the fly".

So, here's a couple of (possibly stupid) ideas.

1) For Each <array>
      do something
   ' No indexer, no garbage, the implied indexer would only have scope 
inside the loop.

2) Less personally favored but possibly useful:
   For idx as Integer = -Infinity To Infinity ' or some other bounds 
that are meaningful.
     <array>[idx] 'do something
   ' idx survives, but only until it is next proposed as an indexer

I mean, just because "some other language" proffers the opportunity to 
create gibberish code, it doesn't mean that Gambas has to.  In fact, 
further, why not create something new and useful?

Anyway, just my thoughts. (Thanks Rolf! You crystalised what I was 
trying to think about.)

best regards

More information about the User mailing list