[Gambas-user] What are the {} enclosed variables

Rolf-Werner Eilert eilert-sprachen at ...221...
Fri Mar 5 10:01:23 CET 2010


Am 05.03.2010 09:23, schrieb Benoît Minisini:
>> Hi
>>
>> The ghostwriters have been a bit ephemeral.
>>
>> How about a simple:
>>
>> To use a property name that is also a Gambas reserved name in your personal
>> class, you must enclose the property name within {}.
>>
>> For example:
>> Property Font as Font
>> Property Left as Integer
>>
>> will both cause a compile error.
>>
>> Property {Font} as Font
>> Property {Left} as Integer
>>
>> will not.
>>
>> rgds
>
> { ... } is a syntax that prevents the compiler from interpreting a symbol as a
> reserverd keyword. It allows to use any symbol as an identifier.
>
> This syntax comes from Visual Basic.
>
> Regards,
>

I find Charles' approach more straight-forward, it points to the 
solution, not the problem. This is exactly what the less gifted 
programmers like me would look for ;-) But the explanation for VB isn't 
bad, either. Maybe we could mention this too:

---
To use a property name that is also a Gambas reserved name in your 
personal class, you must enclose the property name within {}.

[then the examples]

Thus the compiler is kept from interpreting a symbol as a reserved 
keyword which allows you to use any desired symbol as an identifier.
---

And it changes the original text so we do not produce copyright problems...

Rolf





More information about the User mailing list