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

Re: enum and named sets


It seem he just want a syntaxes sugar.

that's why I suggest the collection way ... well not tested and buggy :)..

I think the best will be a named enumeration. But Keep in mind that the
count of enumerations will be separated

Enum MyEnum Val1, Val2, Val3
Enum MySecondEnum

Inc Marray[MyEnum.Val1]

Or maybe a new type of enum for backward compatibility.

The other advantage can be for the parameters in functions

Private sub MyFunction(Param1 as MyEnum)

SO it can accept only a param from a MyEnum  enumeration ...







Le mar. 9 déc. 2025 à 03:55, Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> a
écrit :

> There should NOT exist private enums or enums which cannot be exported.
> Someone is going to use them in some library/interface and then change
> later breaks everything using the library.
> I have suffered this in C a few times. I never use enums.
>
> Jussi
>
> On Sat, Dec 6, 2025 at 10:10 PM Brian G <brian@xxxxxxxxxxxxxxxx> wrote:
>
>> Would it be useful or possible to allow the naming of enum sets such
>> that they could be referenced by that name
>> collectively without having to generate a special class with just a
>> public enum. This could be very useful I think.
>>
>> Or maybe there is already a simple way to do this!
>>
>> Such that
>>
>> enum this_set_name  none,fast, slow,red,green
>>
>> this allowing things like
>>      dim setcounter[] as new integer[5]
>>      inc setcounter[none]
>>      inc setcounter[green]
>>
>> or
>>
>>      for each xx as variant in this_set_name
>>          print setcounter[xx]
>>      next
>>
>> --
>> ~~~~ Brian
>>
>>

-- 
Fabien Bodard

References:
enum and named setsBrian G <brian@xxxxxxxxxxxxxxxx>
Re: enum and named setsJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>