You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So one thing we do a lot is pass in a type to specialize on. And thanks to std.meta.traits we can write functions that are arbitrarily complex and get a bool back that tells us if it fulfills some requirements. However right now you have to put checking for traits in the function and not as part of the signature. While this isn't the biggest deal I think it would be a good idea to be able to put in a set of boolean expressions evaluated at comptime and if any of them evaluates to false it will result in a compile error that tells you which expressions evaluated to false. This should let us put the compile error at the call site rather than in the function and it removes some code duplication.
The text was updated successfully, but these errors were encountered:
It would be a bit nicer if it's always invoked @compileError with a human friendly error instead of a bool flag since after a few constraints it becomes difficult to generate meaningful error automatically. #6615 is related and could provide the same thing by @compileError in the function called on the type.
So one thing we do a lot is pass in a type to specialize on. And thanks to std.meta.traits we can write functions that are arbitrarily complex and get a bool back that tells us if it fulfills some requirements. However right now you have to put checking for traits in the function and not as part of the signature. While this isn't the biggest deal I think it would be a good idea to be able to put in a set of boolean expressions evaluated at comptime and if any of them evaluates to false it will result in a compile error that tells you which expressions evaluated to false. This should let us put the compile error at the call site rather than in the function and it removes some code duplication.
The text was updated successfully, but these errors were encountered: