[Gambas-user] Wiki Update
Tobias Boege
taboege at ...626...
Wed Sep 17 15:04:05 CEST 2014
On Wed, 17 Sep 2014, Randall Morgan wrote:
> We were looking at: http://gambaswiki.org/wiki/cat/arraydecl
> But don't all array indices in Gambas begin at Zero?
>
What does it mean to be an array? I'm not sure. If you call an "array" what
can be used like an array then these are the classes implementing the _get()
and/or _put() special methods.
Collection also implements these methods but takes string indices. Tomorrow
I can add "Matlab-compatible" classes to a component which index from 1 on,
or a class that uses matrices or powers of Pi to index.
But yes, if you qualify an array as either:
a) native arrays or
b) array classes created on-the-fly by the interpreter when using the
<ClassName>[] syntax ("derived arrays")
then you can say that indexing begins at zero, for sure. These make ~ 80%
of array uses in my projects, from a very quick grep. So much for its
raison d'etre.
Maybe we should add an article into the Lexicon[0]?
Regards,
Tobi
[0] http://gambaswiki.org/wiki/def
--
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
More information about the User
mailing list