Hi,

If you use the development version, now you can declare typed object arrays:

DIM ArrayOfLabels AS Label[8, 8]

The Label[] class is dynamically created by the interpreter the first time it 
is used. 

It has exactly the same features as the Object[] class, except that it always 
returns Labels, not Objects.

So, something like:

  ArrayOfLabels[1, 1].Text = "Hello"

becomes faster as the interpreter now knows that ArrayOfLabels[1, 1] returns a 
label, and so can optimize the property access.

This feature is more powerful. Any class can be followed by "[]" to become an 
typed array class, and this process is recursive.

So "String[][][]" is an array of array of array of String! I don't know if it 
useful in that specific case...

At the moment, the IDE automatic completion does not understand this new 
syntax. But it is planned.

I want to enhance this "template" feature: I'd like to do something like:

DIM MyIndex AS String.Collection

to be able to declare a Collection whose elements are strings. It could be 
faster than using the standard Collection, whose elements are variants.

Then we will be able to do weird things, like:

DIM WhatTheFuck AS String.Collection[].Collection

That would be a Collection whose elements are arrays of Collection whose 
elemnts are String.

And maybe we could go further: using any class as template. Something like:

DIM MyListOfString AS String.List

where List is a class written in Gambas.

I don't know that last feature would be really useful anyway.

Waiting for people comments now... :-)

Regards,

-- 
Benoit Minisini

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to