-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Rename str2var
to str_to_var
and similar
#64367
Conversation
The |
636d825
to
a729155
Compare
@Calinou Thoughts on this? I support this rename of 2 to "to". |
The mentioned reply is among the most liked in the tracker. |
Doesn't deg2rad/rad2deg also need to be changed? |
Oopsie. Will update as soon as possible. |
a729155
to
0c4bb10
Compare
Updated to include |
0c4bb10
to
638a0fb
Compare
The last time this was discussed, we didn't decide how far the naming change should go. For example, with these changes it no longer makes sense to use shortened terms, e.g. str instead of string, deg instead of degree. The 90s naming scheme is more forgiving in that regard. The new naming starts to look weird without proper renames. |
I personally think that going "too" far would do the opposite of what the PR is meant to do, that is, potentially making the code too verbose and actually harder to read. In fact, and I don't know what to make of this... // Before.
p_rotation_offset = Math::deg2rad(rotation_offset->get_value());
p_rotation_step = Math::deg2rad(rotation_step->get_value());
// After.
p_rotation_offset = Math::deg_to_rad(rotation_offset->get_value());
p_rotation_step = Math::deg_to_rad(rotation_step->get_value()); |
@YuriSizov Shortened terms, even acronyms are OK, but "2" instead of "to" or "too", and "4" instead of "for" - these are more like interwebz slang. |
Missed With these added, I'm 99% sure no methods are missed |
Approved for the list present in this PR/linked proposal |
There's some of these that have been missed in this PR. What about them? Would it still be possible to make a separate PR for them? |
You can add inst2dict and dict2inst here, I think. I'm not sure there is anything else that needs changing. Feel free to bring it up, I guess, in the next few days or so. |
0db0a99
to
e1d6ff8
Compare
This comment was marked as resolved.
This comment was marked as resolved.
2376508
to
311ba3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We approved this in a bikeshedding meeting.
I'll check locally to make sure everything is properly converted.
C# solution fails building with:
|
311ba3a
to
42c3e44
Compare
Epic merge fail. |
There seems to be some code in Mono that might still need porting:
CC @godotengine/dotnet Everything else seems good. |
Oooh I did see it, I actually wasn't sure what was the naming scheme used for them ( |
The naming scheme would be |
42c3e44
to
18c88ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mono module looks good except for a few rebasing mistakes.
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too. - `var2str` -> `var_to_str` - `str2var` -> `str_to_var` - `bytes2var` -> `bytes_to_var` - `bytes2var_with_objects` -> `bytes_to_var_with_objects` - `var2bytes` -> `var_to_bytes` - `var2bytes_with_objects` -> `var_to_bytes_with_objects` - `linear2db` -> `linear_to_db` - `db2linear` -> `db_to_linear` - `deg2rad` -> `deg_to_rad` - `rad2deg` -> `rad_to_deg` - `dict2inst` -> `dict_to_inst` - `inst2dict` -> `inst_to_dict`
18c88ca
to
59e1193
Compare
Thanks! |
`deg2rad` was renamed in Godot (godotengine/godot#64367)
This is a great, welcome change. As I english isn't my first language, I usually end up reading numbers in my own language (finnish), resulting in strange sounding functions (varkaksistr etc.). I'm sure I'm not the only one who had this problem. Glad it's getting changed :) |
* Godot 4.0 beta 1 import file updates * API rename: `update` is now `queue_redraw` Per godotengine/godot#64377 * API rename: `x2y` functions are now `x_to_y` Per godotengine/godot#64367 * Update types: `UndoRedo` is now an internal of `EditorUndoRedoManager` Per godotengine/godot#59564 * beta 3 Co-authored-by: Jeff <jeffrey.arneson@gmail.com>
Closes godotengine/godot-proposals#5206.
As brought up in #54161 (comment).
To make it short, the naming scheme with "2" in the middle is not always used across Godot (
String.int_to_bin()
), and it isn't proper English.Affects the internal Math class, a good chunk of the audio filter code, and a lot of miscellaneous classes.
var2str
var_to_str
str2var
str_to_var
bytes2var
bytes_to_var
bytes2var_with_objects
bytes_to_var_with_objects
var2bytes
var_to_bytes
var2bytes_with_objects
var_to_bytes_with_objects
linear2db
linear_to_db
db2linear
db_to_linear
deg2rad
deg_to_rad
rad2deg
rad_to_deg
Added later in this PR:
dict2inst
dict_to_inst
inst2dict
inst_to_dict
I think it's worth noting, before merging this, that while testing I did find writing these methods to be much slower (underscore, two characters, another underscore, and the Italian keyboard requires holding Shift to access the underscores), although it may be a matter of getting used to it.