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

Charlie Reinl Karl.Reinl at ...2345...
Fri Mar 5 13:52:43 CET 2010


Am Freitag, den 05.03.2010, 10:01 +0100 schrieb Rolf-Werner Eilert:
> 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

Salut,

as I saw there are two places to set it :

first:
Variable Declaration
http://gambasdoc.org/help/lang/vardecl

second:
Local Variable Declaration
http://gambasdoc.org/help/lang/localdecl

If there is(are) a better place(s) let me know, I will do it this
weekend.

At the end of the two mentioned pages I will add the following text. 

Special in Declaration:

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:

will both cause a compile error.|will not.
--------------------------------+-------------------------------------
Property Font as Font		|	Property {Font} as Font
Property Left as Integer	|	Property {Left} as Integer

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


-- 
Cordialement
Charlie





More information about the User mailing list