[fpc-pascal] Scoped enums and inferred types

Michael Van Canneyt michael at freepascal.org
Wed Feb 21 16:13:20 CET 2018

On Wed, 21 Feb 2018, Ryan Joseph wrote:

>> On Feb 21, 2018, at 5:16 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>> I simply rely on my IDE (Lazarus, Visual Studio)  to complete long identifier names for me so that I don't have to. *shrugs*
> Sure enough it’s not a pressing matter by any means but I thought it was worth asking about since I saw it in Swift and it made sense. 
> Adding compiler features is a slippery slope and I have no idea where to
> draw lines.  Scoped enums aren’t necessary and in fact enums in general
> could be replaced with constants easily enough so that feature was
> probably debated at some point also.

You lose an important type safety if you replace them with constants.

Enums have their uses.

As long as you stick to conservative use and accept that the compiler
manages them, they are a powerful and useful construct. Otherwise you're
probably better off using constants.


More information about the fpc-pascal mailing list