[Gambas-user] how can i emulate GLOBAL VARIABLES in gambas project/programs?

Tobias Boege taboege at gmail.com
Wed Jun 20 17:17:33 CEST 2018


On Wed, 20 Jun 2018, PICCORO McKAY Lenz wrote:
> 2018-06-20 3:42 GMT-04:00 Christof Thalhofer <chrisml at deganius.de>:
> 
> > Am 15.06.2018 um 20:52 schrieb PICCORO McKAY Lenz:
> > > umm i cannot avoid the "global." prefix! right?
> >
> > No, but you can give it another name.
> >
> any way to create dinamically?¡
> 
> just like php does with $$ ?
> 

To store variables whose names you don't know at compile time, you normally
use a Collection. The most syntactic sugar you're going to get is via the
special methods _property and _unknown or _get and _put [1]. Forward accesses
to your Global module through these interfaces to an internal Collection.

Regards,
Tobi

[1] http://gambaswiki.org/wiki/cat/special

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list