I can do:
myerrorlevel := errorlevel(3458967478)
It would be good if there was some way of specifying that this type can only accept these values.
Thinking about it, it's the same as nil-safe types - being able to specify to the compiler that this type cannot accept a nil value.
From an external package you can only access the explicit values and the functions that accept them as parameters. The type is opaque for the developer.
I can do:
and the compiler won't complain at all.It would be good if there was some way of specifying that this type can only accept these values.
Thinking about it, it's the same as nil-safe types - being able to specify to the compiler that this type cannot accept a nil value.