[fpc-pascal] Enum property can't be published

Hairy Pixels genericptr at gmail.com
Tue Sep 27 14:02:10 CEST 2022

> On Sep 27, 2022, at 5:19 PM, Pierre Muller via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>  TDiagnosticSeverity = ( NoError { will be 0},
> 			  Error {will stay equal to 1},
>                          Warning {will stay equal to 2},
>                          Information  {will stay equal to 3},
>                          Hint {will stay equal to 4}
>                          );
> Not a general solution, but a very simple one in that specific case!

I like that actually, thanks. There’s a number of these 1 indexed enums but I think this trick will work in most cases.

I know some languages have the convention where you can set just the first index of the first value to set the indexing. That would be a good feature to add to Pascal so we can still publish the enums safely for APIs that have 1 indexing.

 TDiagnosticSeverity = ( Error = 1,

	Ryan Joseph

More information about the fpc-pascal mailing list