The general idea was to replace @Type with specific functions, but only for those types which cannot be created in a more usual way.
The method @rpkak demonstrates is perfectly adequate, so that’s probably why there’s no @ErrorSet type. It’s actually less ceremony than the original method you were using for @Type, even if the O(n²)-ness of the algorithm makes me wince a bit. It could be optimized, no idea if it is, but in any case it won’t affect runtime.
the switch should just be an access to @typeInfo(E).@"enum", imo, since the else branch duplicates or does less well than the default compile error for bad union access
The argument is that the ability to do @Type(.{ .optional = Foo }) means there’s an extra-canonical, funny-looking way to make every type, but there’s never any reason not to simply write ?Foo.
So the decision was made to break @Type apart into a collection of category-specific builtins, only for the type categories where it’s useful to have.
Fair enough, though I thought that the property of “the inverse of @typeInfo is @Type” was pretty elegant. Arguably worth preserving at the expense of more than one way to do things, but that isn’t what’s happening.
I suggested just making redundant use of @Type into a compile error which tells the user how to do it, like
error: @Type will not create an optional, use ?T
But promoting the tag to a builtin does reduce verbosity, just @Struct(... instead of @Type(.{ .@"struct" = ..., and breaking it up for parts is easier to document, so this is probably the better outcome.
presumably, the goal is to create an error set with a comptime-known (but not explicitly typed out) set of error names which are available in the program at compile time as strings but might be generated by comptime code execution. you might imagine this could save significant typing if you wanted to create, for example, 256 different errors, each with a 20-character name.
now, is this a good idea? no, probably it’s usually a bad one, even.