[Gambas-user] About help and arrays and variables

Demosthenes Koptsis demosthenesk at ...626...
Fri Nov 19 13:27:23 CET 2010


On Fri, 2010-11-19 at 01:38 +0100, Benoît Minisini wrote:
> > Can someone explain embedded arrays further?
> > 
> > i understand nothing.
> > 
> > i know what a normal array is and that it can be static or dynamic.
> > 
> > But "embedded arrays are just a way to access a part of a Gambas object"
> > 
> > for example i have a TextBox1 how can i use an embedded array on it?
> > 
> > You mean do use the TextBox1 as an array..? For example to enumerate its
> > properties? i cant think what do you mean.
> > 
> > If there is an example to demonstrate the differences. Please.
> > 
> 
> First, have you read the documentation page about Gambas object model?
> 

Yes i did. But i try to understand.

Thanks Fabien!

So

1) PRIVATE aInt1[3] AS Integer
is an embedded array of integers with 3 elements in an object for
example FMain.

2) DIM iFieldr AS NEW Integer[9]
is a static array of integers with 9 elements 

3) Also PRIVATE Languages AS String[] = [ "fr", "it", "es", "de", "ja" ]
is a static !!!
(so far i thought that this was a dynamic array, because it was declared
with no dimensions PRIVATE Languages AS String[])

4) A dynamic array has global reference, where is it declared ?

A dynamic array declaration how is it?

Example?


ps:
so far i knew that 
1) a static array has fixed dimensions, cannot be resized
2) a dynamic array can be resized, has no static dimensions. 
so i thought a 
DIM aInt AS Integer[5] is a static
and
PRIVATE aInt AS Integer[] is a dynamic 

but i saw that in both declarations i can do

aInt.Add(6) and to add elements.

The terminology of static and dynamic is different in Gambas or i am
wrong again? 


2010/11/19 Fabien Bodard <gambas.fr at ...626...>:
> http://gambasdoc.org/help/cat/objectmodel
>
> http://gambasdoc.org/help/cat/arraydecl
>
> Ok so,
>
>
> an embedd array is a private array...
>
>oups i forgot to read this line in the help :
>
>"In Gambas 3, embedded arrays cannot be used as local variables
>anymore. But they can be public!"
>
>so the only advantage to static array i see it's that they die with
>the object :)
>
> you cannot give it as argument throw a procedure ex :
>
> Public mysub(myVar as MyArray[])
>
> Like we can do with a dynamic array that have global reference such as
> any objects
>
>
> The embedd array have the same memory space than the object into it is
> initialized... so it die with this object
>
>
> A dynamic array will be alive all the time it is referenced somewhere
> in the project. like any gambas objects.
>
>
> Yes i prefer dynamics one ... and i think , like Benoit i don't use
> static one any more.
>
>
> Le 19 novembre 2010 01:38, Benoît Minisini
> <gambas at ...1...> a écrit :
>>> Can someone explain embedded arrays further?
>>>
>>> i understand nothing.
>>>
>>> i know what a normal array is and that it can be static or dynamic.
>>>
>>> But "embedded arrays are just a way to access a part of a Gambas
object"
>>>
>>> for example i have a TextBox1 how can i use an embedded array on it?
>>>
>>> You mean do use the TextBox1 as an array..? For example to enumerate
its
>>> properties? i cant think what do you mean.
>>>
>>> If there is an example to demonstrate the differences. Please.
>>>
>>
>> First, have you read the documentation page about Gambas object
model?
>>
>> --
>> Benoît Minisini
>>
>>
------------------------------------------------------------------------------
>> Beautiful is writing same markup. Internet Explorer 9 supports
>> standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
>> Spend less time writing and  rewriting code and more time creating
great
>> experiences on the web. Be a part of the beta today
>> http://p.sf.net/sfu/msIE9-sfdev2dev
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>
>
> --
> Fabien Bodard
>









More information about the User mailing list