-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
String.is_subsequence_of is either broken or has a very misleading name #37063
String.is_subsequence_of is either broken or has a very misleading name #37063
Comments
Instead of renaming or documenting - I've combined both of those suggestions, and overloaded that method with additional parameter, which allow you to specify, if you want to go without any gaps - check attached PR. |
The name is not misleading, it's the correct behaviour for a subsequence. What you expected is a substring. |
I've modified my PR according to your request, I agree it's nicer to separate both of them. |
A separate is_substring_of method and a clarification on subsequence is a pretty good improvement. I will point out that this will still almost certainly end up with people misusing it, who simply didn't read the fine print. Maybe mathematicians use the word subsequence to mean a specific thing, but that doesn't define how language is used and understood by people outside of the field, which is the vast majority of Godot users. It's a question of UX not academics. However, I certainly don't care about this small quirk enough to seriously champion further change, but I feel compelled to point out "That is still bad UX, but it's at least better than what it was." What the Godot dev team does with that is up to you guys. |
This is an interesting case study in feature discoverability and (rather appropriately) fuzzy matching... The
|
Godot version:
3.2
OS/device including version:
All versions
Issue description:
is_subsequence_of returns true is all characters from string A appear in string B, in the order in string A, but it doesn't care if characters not in A are interwoven. So:
"save5".is_subsequence_of("save35")
returns true.
This seemed like such an odd behaviour it feels like a bug? I suspect there's a chance this is actually intended behaviour, used as sort of a fuzzy search within the engine itself. I feel like if that's the case this should probably be renamed, or at least documented.
Steps to reproduce:
Above line of code should do the trick.
The text was updated successfully, but these errors were encountered: