How do I create a unit with only enums in it?

I try to create a unit with only enums in it:

namespace NS;
interface
testEnum = enum(a=0,b=1);
implementation
end.

The enum is not compiled.

But if I add a type to it:

namespace NS;
interface
type x= class end;
testEnum = enum(a=0,b=1);
implementation
end.

Everything works.
How can I make a unit without the type?

Have you tried public enum?

you’re missing the type keyword. I’m surprised this first sample compiles at all?

1 Like

ps, it doesn’t here for me. s expected:

namespace NS;
interface
testEnum = enum(a=0,b=1); // E3 "implementation" or interface section members (types or methods) expected
implementation
end.

No, the first example does not compile.
That was the problem; I only want enums in this unit, but I have to add a type before I can compile.

Well just the type keyword.
type testenum = enum (a = 0, b = 1); works fine.

1 Like

So thats just as designed then? Pascal needs the type keyword before declaring types… If you omit it, it will fail.

yep - as designed.
This was the first time that I tried to make a unit with only enums in it …

1 Like