-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
missing update operators (<op>=) #20422
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
Comments
I've realised |
What makes you think that? See also #5804 and #16511.
Do you have a use case where these operators are particularly useful? Bear in mind that Zig is a language focused heavily on readability -- code being faster to write isn't typically a good justification for a new langauge feature, particularly if readability is harmed (and I would argue these operators absolutely harm readability). |
Agree with mlugg about the short circuiting behaviour being unintuitive. I think another weird part about Only thing I can think of is to somehow "build" boolean expressions, but I don't think I'd want to encourage that anyway.. |
Honestly, I came to this issue just from Only then did I realise there were other operators missing and thought it might be a more general thing. But it seems like there are different reasons for different ones not being included. Thanks. |
this isn't necessarily true; but also its rare enough in use that it's prolly fine to not add new syntax |
I'll say that I've actually had quite a lot use personally for " |
Can y'all give an example of where it would be valid to use? Where today you use |
Please read #16511 and direct further discussion of |
Uh oh!
There was an error while loading. Please reload this page.
Zig Version
0.14.0-dev.93+ccd3cc326
Steps to Reproduce and Observed Behavior
||=
,and=
,or=
,++=
,**=
do not exist, but as far as I can tell this is just an oversight.Expected Behavior
Any operator with a result type the same as it's first argument would have an
<op>=
variant withx <op>= y
is the same asx = x <op> y
.The text was updated successfully, but these errors were encountered: