Renaming Node.get_index to Node.get_sibling_index #9744
Replies: 3 comments 3 replies
-
To me "sibling index" isn't clear, and it doesn't make sense to me to change the name just because another engine uses a particular naming But for helping confusion we can add it as a keyword to the method and it'll be easier to find |
Beta Was this translation helpful? Give feedback.
-
I ran into the same issue a long time ago. But the other way around. I did not know how other engine names this method. I tried searching for method like |
Beta Was this translation helpful? Give feedback.
-
I think sibling is a common term used in tree APIs, not just in Unity, but for instance also in several Java libraries. However it seems that practically all of them are based on iteration, rather than indices. Would it make sense to leave the existing one untouched, and add iteration-based ones which include sibling in their name? In Java I have seen methods on tree nodes with signatures like "get_prev_sibling" and "get_next_sibling". |
Beta Was this translation helpful? Give feedback.
-
It took me a while to figure out that godot even had a method of determining the node's sibling index in a tree. Namely because I searched everywhere for "sibling index".
I am proposing renaming get_index to get_sibling_index because it's more obvious, and it is also the same alias that Unity uses which may help lots of people transitioning into godot.
Unfortunately this is an obvious breakage of the api so would constitute a major version upgrade. Let me know what yall think!
Beta Was this translation helpful? Give feedback.
All reactions