-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
AstGen: add error for redundant comptime var in comptime scope #18242
Conversation
I thought I remembered a proposal-like discussion somewhere to require My own two cents of why I'm not too fond of this change:
At Workaround I thought of while writing this comment: |
This is only for cases where With regard to the specific use case you mentioned: doing this with |
From my understanding, Zig's explicit goal with
That conflicts with my current understanding - I cannot find any basis for it in #7396, and don't remember it from any other issues. Your suggestion of explicitly writing EDIT: Rethinking it in light of some |
|
@matu3ba While number precision wasn't mentioned in this thread yet, it's certainly also an interesting topic. Anyway, I don't see a connection between floating point imprecision, and lifetime/memory semantics in relation to language syntax. |
In addition to this, I think that |
During compilation time, you want portable behavior which also includes at least the option to have portability across floating point operations. Portability across floating point operations mandates arbitrary precision numbers, which require allocations at compilation time to handle etc. During runtime mostly runtime performance is much more important. How and if to make both work with the same code paths at scope/fn level remains unclear/not well motivated yet. The comptime block in the langref does not clarify semantics at all. |
Nice, thank you. |
Inspired from #18227