-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Add logical XOR to GDScript #76191
base: master
Are you sure you want to change the base?
Add logical XOR to GDScript #76191
Conversation
You have not linked a proposal suggesting this or defended your case. For booleans, |
There's already an open proposal: godotengine/godot-proposals#3849 It hasn't garnered much community support, and the original idea was already rejected more than once. |
Why |
I've choosed "^^" because I thought it would make sense aliases-wise. |
Sorry about that, I'll look into it! It's not the same thing, though, I mean...
|
5070632
to
dec3364
Compare
shortened this even more for you ^^. For booleans != is equivalent to xor. Or if I am misunderstanding your example and the booleans are supposed to be the foo == 0 part:
Truth table for
Truth table for xor
|
You're right!
|
For autocompletion you need to add the keyword here: godot/modules/gdscript/gdscript_editor.cpp Lines 1244 to 1248 in e0e93ce
|
d63b799
to
10ecc1a
Compare
I think checks are not working because of documentation but I don't know what to do, atleast not right now. |
d2e7994
to
50102f7
Compare
e50c4d5
to
22a2a06
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added some changes in addition to yours. You can apply the patch with git apply
or git am
. Please note that this PR should have one commit (not multiple). If you want, you can add me as a co-author, but it doesn't really matter to me.
P.S. Sorry for the long reply, I was sick and couldn't review your PR.
ca1245c
to
930832b
Compare
applied requested changes Co-authored-by: Danil Alexeev <[email protected]>
930832b
to
74f4e19
Compare
That's OK, thank you for your patience and help! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@JeffVenancius If you could rebase your PR, we could merge it soon. :) |
Well, perhaps we should discuss this with the whole GDScript team, given the proposals for this are controversial. Even so, this PR cannot be merged as is because it only adds the keyword to the language, it does not implement the actual operator at runtime. It would also be nice to add tests, to verify the implementation itself. |
FWIW, this PR seems related to the boolean operators section of the style guide where it is encouraged to use AND, OR, and NOT instead of &&, ||, and ! |
This is an incomplete implementation of a logical XOR.
I've used 'but' and '^^' as keyword and aliases. It works but only if you do one comparison at a time.
There's no highlighting for 'but' and there's no auto-completion.
I'll keep working on it, still.