-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
GDScript: Stringy StringNames #75170
Conversation
cd18fee
to
20dea82
Compare
20dea82
to
1e8a752
Compare
1e8a752
to
f876cf1
Compare
I don't see a good reason for this restriction.
I do not think it's a good idea. In some places,
We try to avoid inconsistent and non-symmetric behavior (for "equal" objects - in math, the equivalence relation is reflexive, symmetric, and transitive). But as I said, I don't think the previous point is a good idea.
For In general, I'm not opposed to add the exception for var x = NodePath("abc")
match x:
"abc":
print("match")
_:
print("not match")
# not match It works this way in both 3.x and 4.0, your PR doesn't fix it either, many users use |
I don't think that "confusing by default, but with a less strict and more predictable alternative" is a good trait for a programming language feature. As @vnen mentioned, I agree, though, that this PR seems rather excessive in its changes, and goes way beyond the original issue. |
In my understanding, this design (strong type checking unlike the But what I'm trying to point out is that going against this design can be even worse (whether the design is good or bad, unintentional or deliberately chosen). Worse than exceptions can only be exceptions to exceptions. To me, this looks like an ad hoc patch that doesn't fix a problem, just one of its symptoms. But the real problem is on another level. Perhaps in the future we will decide that (By "design" I mean not necessarily a conscious choice when making a decision, but rather the self-consistency of a feature.) |
If |
I guess it's too late to change |
I don't know, we are changing the behavior here either way. By the time we release this, in 4.1, some code will be written with the existing behavior in mind, and will be broken in some ways. And personally, I'm not sure there is a lot of code out there that depends on 1 and 1.0 being different in a match statement, or depends on nodepaths not matching strings. The way I understood George, all of this kind of exists for legacy reasons. So IMO all of this can be subject to change if we want to improve expected behavior. I appreciate strict type checks, but as a user I'd expect the change between |
I have a guess why it was done this way. The
But even if we implement it differently (if this comparison with the |
The PR has been reviewed by the GDScript team. We agreed that So, @rune-scape, can you split your PR to make the Thank you for your PR, very appreciated. |
I think this PR should be closed as a new one has been opened (#78389). There is a consensus on what the behavior of Or at least this PR should be removed from 4.1 milestone. |
Closing the PR for the reason given by @dalexeev. @rune-scape, if there's anything, feel free to reopen it. |
another follow-up to #68747
match
behavior consistent (String
vsStringName
) #74872)is
keyword) now counts StringNames as Strings:but not the other way around (eg. "abc" is not StringName)