-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Allow usage of is not
in GDScript
#1319
Comments
Previous discussion: godotengine/godot#3677 |
"in" does not exist to my knowledge, unless this was newly added in 4.0. It also is a bit extreme to add, given that And I don't see why we need a whole addition to the language just to have the occasional line be a little bit more correct in English. |
I do not want Trying to shoehorn natural english into expressions like this is a huge mistake in my opinion I would be less opposed to an isnt-operator, like |
It does, I'm currently using 3.2.2 Stable |
is not
and not in
in GDScript
Note that
|
I like pythons Having said that, pythons |
We actually amended the docs not so long ago to make sure people stop with this misconception, but high level similarity still makes some community participant to make comparisons. 🙃 |
I'm not sure about
|
I support this suggestion @export var options : Array[PackedScene]:
set(v):
for value in v:
if value != null:
var instance := value.instantiate()
if instance is not Control:
instance.queue_free()
return
options = v due to the fact that godot doesn't support typed packed scenes yet. The only way I can seem to do this is if I do this... var instance := value.instantiate()
var node := instance as Control
if !node:
instance.queue_free()
return which looks ugly Production edit: added gdscript syntax highlighting to code. |
Use PackedScene.get_state() to query the saved state for the root nodes type. |
is not
and not in
in GDScriptis not
in GDScript
Describe the project you are working on:
This issue works for all projects that use the keywords "in" and "is"
Describe the problem or limitation you are having in your project:
When trying to use the opposite of "in" and "is", most people, especially the people who have used Python before would use "a not in b" and "a is not b" instead of "not a in b" and "not a is b". In Python, both the former and latter example works, but in GDScript only the latter is valid syntaxes.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Just allow usage of "a not in b" and "a is not b", which not only are in Python but also make sense grammatically
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
a is not b #equivalent to not a is b
a not in b #equivalent to not a in b
If this enhancement will not be used often, can it be worked around with a few lines of script?:
The keywords themselves should be used quite oftenly, but yes its easy to have a work around.
Is there a reason why this should be core and not an add-on in the asset library?:
It's a simple quality of life improvement that is pretty straightforward to implement and helps with the workload a lot.
The text was updated successfully, but these errors were encountered: