# Why not use a constructor
Let's start with

There is two points here:
1. The `constructor` is returning an `AuthChanges` type which is an `any`, even though the argument should be of type `Constraint`, the returned value type stills any.
2. The `Check` function which evaluates the 'enum', has as parameter an argument of the type `any` which is not useful (neither type-safe) since the point is to ensure the 'enum' type at comptime and here the `Check` function don't have this guarantee
So, to prove that this code is just adding complexity without adding any comptime ensurance, we can decompose it to:

Both implementations produces the same output, the `Check` method does not have any ensurance of what it is receiving is a `AuthChanges`

By having a constructor or not, the comptime check does not exists, this is a superfluous constructor.
After doing a research on how to implement **tagged unions** or enums in golang I found that the better approach that introduces less overhead and brings type assertion at comptime is using interfaces, but not the same interfaces as `any`!
Here is how you can implement:

1. `AuthChanges` is not any anymore it is an interface with a dummy method, this method is important because it will group all the cases also bringing type-safety to the `Check` method
2. We can have a type-safe switch case removing the default or having the default as a exhaustion point, for example the `_` in the rust's `match`
3. If you look at the `main` function, we try to pass values that don't satifies the interface which gives use the following output:

The above image is a comptime error saying that is not possible to use 10 (constant of type int) as `AuthChanges` value. Also it fails because we're trying to use a `NotAChange` instance as argument to the `Check` method but `NotAChange` does not implement `AuthChanges`.
The latest implementation/example is the optimal since it has type-safety using the lang behavior
Golang code: https://go.dev/play/p/A3tb0TcZOud
ref 1: https://zackoverflow.dev/writing/hacking-go-to-give-it-sumtypes
ref 2: https://www.reddit.com/r/golang/comments/13hjevf/idiomatic_way_in_go_to_represent_a_tagged_union/