-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
comptime type deduction #984
Comments
have you seen this yet? fn foo(a: var) void {
}
test "aoeu" {
var a: u32 = 5;
foo(a);
} |
I have not seen that yet, should cover a lot of cases. But what about enforcing same types
Would have to include a typeof check in the body |
That can work like this: fn foo(a: var, b: @typeOf(a)) void {} However perhaps you want to resolve the types with peer type resolution. There's an open issue for that: #439 |
Good to know typeOf works likes this. Thanks. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems like this might become a common pattern for generic coding in zig
In these cases the compiler knows the type of a, it would be useful if you did not have to supply the type.
Maybe some reorganization of the function signature.
The text was updated successfully, but these errors were encountered: