|
|
|
|
|
by PreInternet01
586 days ago
|
|
You can do this in C# as well, so that the final line in the snippet below causes a compile-time error, which is quite nice for many purposes: private enum Derp { }
private enum Foo { }
var derp = (Derp)12;
var foo = (Foo)99;
foo = derp;
However, this is definitely a hack, and I sort-of feel the same about the Zig solution from the article. Would be nice if languages had 'cleaner' support for this? |
|