[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Happy New Year


Thank you very much. Investigating mode on...

El dom, 4 ene 2026 a las 23:06, Fabien Bodard (<gambas.fr@xxxxxxxxx>)
escribió:

> merci :)
>
> Le dim. 4 janv. 2026 à 19:21, Benoît Minisini <
> benoit.minisini@xxxxxxxxxxxxxxxx> a écrit :
>
>> Happy New Year 2026 to everyone!
>>
>> During the holidays, I have added support to "named enumerations" to
>> Gambas.
>>
>> What's that new feature?
>>
>> First, you have a new syntax for declaring enumerations by specifying an
>> "enumeration name".
>>
>> --------------------
>> Public Enum <Name> Is <Constant 1> [ = <Value1> ], <Constant 2> [ =
>> <Value2> ] ...
>> --------------------
>>
>> Two remarks:
>>
>> - You can now reuse an already declared integer constant in the
>> enumeration. It allows you to both have a specific documentation for
>> that constant, and have an enumeration using it.
>>
>> - You can use the same already declared constant in several enumerations
>> if you want.
>>
>> Then, you have a new syntax for declarating datatypes taking their value
>> inside that enumeration, using its name.
>>
>> --------------------
>> Dim <Name> As Enum <EnumerationName>
>>
>> Public <Variable> As Enum <EnumerationName>
>>
>> Public Sub Method(Arg As Enum <EnumerationName>) As Enum
>> <OtherEnumerationName>
>> --------------------
>>
>> It's very important to understand that it's a -compiler only- feature.
>>
>> The interpreter does not see the enumeration. Only integers exist for
>> him. You can assign any integer value to a variable declared as 'Enum
>> <Name>', even the values that are not a member of the '<Name>'
>> enumeration. Nothing is checked at runtime.
>>
>> Moreover, the compiler does not check at all that you actually use an
>> existing enumeration name.
>>
>> The compiler just use the named enumeration declarations to generate
>> metadata (in the '*.list' and '*.info' files), and this metadata is used
>> by the IDE for implementing automatic completion.
>>
>> So it's not a new datatype, but just some new syntax that allows the IDE
>> to implement better automatic completion.
>>
>> At the moment, I added public named enumeration in almost every
>> component, but not the deprecated ones. If you find some missing
>> enumerations just tell me or add it yourself! And if you have any
>> question, just ask.
>>
>> Enjoy it.
>>
>> --
>> Benoît Minisini.
>>
>>
>>
>
> --
> Fabien Bodard
>

References:
Happy New YearBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Happy New YearFabien Bodard <gambas.fr@xxxxxxxxx>