-
-
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
Array & Vector: rename remove()
to remove_at()
, Array, Dictionary & Set: rename erase()
to remove()
#2885
Comments
If you prefer var array := [1, 2, 3]
array.remove(2)
# or
array.remove_value(2) |
Actually I'm thinking maybe |
According to my understanding and thesaurus:
Depending on whether the element is passed by value or by reference, this may not always apply, though. Generally, looks like For example, Godot has When looking at other usages, As you may already know, I prefer less verbosity in Godot API whenever possible. That said, I'd rather use two different words than to rename using the same word to describe different actions. To summarise
Of course, both can be used, as already seen in |
Curious: was my feedback above even useful? I still think I feel like godotengine/godot#49701 and godotengine/godot#50139 were supposed to be merged together, but know we have inconsistency again, something which this proposal supposed to solve. This already creates potential inconsistency with names such as Also, it's not only about Please don't get me wrong, I'm not necessarily against the change, but we have to understand the rationale behind it. If the reason is not clear, someone else in the future may rename those methods again, with the same reason of making API consistent. I say this because I've seen this happening in Godot already (2.0 → 3.0 → 4.0). |
I'm personally glad |
Interesting, I didn't know about this! Still, I would be wary about inheriting naming conventions from other languages, if we do so, it has to be done systematically. But, I think you may agree that GDScript is similar to Python rather than C#. GDScript is a first-party language in Godot and has existed before C# integration. This is not to say that C# is not a first-party language in Godot as well, but there are several reasons why GDScript exists in the first place. I've just looked up Python's Since godotengine/godot#49701 was not merged, we have inconsistency in relation to Python's naming. So, instead of being agnostic/skeptic to naming conventions in other languages, we simply choose some foreign convention. It's impossible to satisfy everyone, that's why I'm suggesting to think for ourselves and come up with a convention that would make sense specifically in Godot (or actually figuring out existing convention, which, yes, does take time reading documentation). Some might even say that what I bring up is a bikeshedding, but recall that naming is the hardest problem in programming! Linguists spend their lives in order to make everything clear! 😃 Just my 50 cents! 🙂 |
I'm sorry but I personally don't see where you're coming from with this. Two methods with basically synonymous names that do different things is confusing to me.
I feel like
Possibly
In the future potentially
https://stackoverflow.com/questions/627435/how-to-remove-an-element-from-a-list-by-index |
Could you explain what exactly makes it confusing? In case you haven't noticed my previous messages, see #2885 (comment). |
Because if the names of the methods mean basically the same thing then it makes distinguishing their functionality a matter of memorization, not intuition.
Well about
But you also said:
I think it's pretty clear that the current 3.x names are not intuitive. |
What I say now is about currently made decision, which created another set of inconsistency. I did this in a way to justify current decision and see if it still makes sense. I still don't quite understand your stance of memorization and intuition: those are not mutually exclusive concepts. Is memorization a problem, or relying on intuition is a problem? I'm curious because English is not my native language. Sorry in advance. |
Yeah I think it'd be a good idea to rename stuff like
What I meant to say is that to someone who is not already familiar with Godot, without reading the documentation it'd be logical for them to assume that
All good :) |
As someone rather new to Godot, but very familiar with other languages such as php and typescript when I saw there was a
It never occured to me that We have functions such as |
I wish this went through in a more notable way. Back when the "renaming season of 4.0" was in process, I thought this had already been changed, but that's not the case. |
See godotengine/godot#49701
Describe the project you are working on
Godot
Describe the problem or limitation you are having in your project
Array's current
erase()
andremove()
methods are poorly named because the words "erase" and "remove" are (for the most part) synonymous.Describe the feature / enhancement and how it helps to overcome the problem or limitation
It was originally proposed to rename
erase()
toremove_value()
, but people seem to prefer renaming it toremove()
(godotengine/godot#49701 (comment)).I think
Set
's andDictionary
'serase()
methods should be renamed toremove()/remove_value()
too for consistency.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
n/a
If this enhancement will not be used often, can it be worked around with a few lines of script?
No.
Is there a reason why this should be core and not an add-on in the asset library?
This is core.
The text was updated successfully, but these errors were encountered: