Skip to content
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

langref: exemplify practical difference between !T and anyerror!T #21454

Open
Des-Nerger opened this issue Sep 19, 2024 · 2 comments
Open

langref: exemplify practical difference between !T and anyerror!T #21454

Des-Nerger opened this issue Sep 19, 2024 · 2 comments

Comments

@Des-Nerger
Copy link
Contributor

Des-Nerger commented Sep 19, 2024

Since anytype in Zig means type inference, people may be misled into thinking that anyerror also does mean type inference; but just for error types. And so, they may get an idea that !T is just an abbreviated and nicer way to write the "frequently used" anyerror!T combination.

I'm not suggesting changing the language itself here, but at least the reference should grab an attention to the distinction, give an example of where one of them could accomplish more than another, etc.

@Rexicon226
Copy link
Contributor

related: #5893

@nektro
Copy link
Contributor

nektro commented Sep 19, 2024

have you noticed this confusion happen in the wild? not saying we shouldnt add this but my initial reaction was that its unlikely given that anytype is the only any thats not a discrete type/value

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

3 participants