Skip to content

Proposal: rename "var" to "infer" in type inference #5346

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

Closed
ghost opened this issue May 15, 2020 · 2 comments
Closed

Proposal: rename "var" to "infer" in type inference #5346

ghost opened this issue May 15, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented May 15, 2020

[ Bikeshedding Alert ]

Zig supports type inference for function parameters:

fn triple(x: var) @TypeOf(x) {
    return 3 * x;
}

However, reusing var for this purpose feels a bit strange, sice it usually marks mutable variables, which have pretty much nothing to do with type inference. I think it would be clearer to just introduce a new keyword:

fn triple(x: infer) @TypeOf(x) {
    return 3 * x;
}
@Vexu
Copy link
Member

Vexu commented May 15, 2020

There is already an accepted proposal to rename it to anytype #4820.

@ghost
Copy link
Author

ghost commented May 15, 2020

Ooops.

@ghost ghost closed this as completed May 15, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant