Theo69
(Theo)
1
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?
joseasl
(joseasl)
2
Have you tried public enum?
mh
(marc hoffman)
3
you’re missing the type
keyword. I’m surprised this first sample compiles at all?
1 Like
mh
(marc hoffman)
4
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.
Theo69
(Theo)
5
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.
ck
(Carlo Kok)
6
Well just the type keyword.
type testenum = enum (a = 0, b = 1); works fine.
1 Like
mh
(marc hoffman)
7
So thats just as designed then? Pascal needs the type
keyword before declaring types… If you omit it, it will fail.
Theo69
(Theo)
8
yep - as designed.
This was the first time that I tried to make a unit with only enums in it …
1 Like