-
-
Notifications
You must be signed in to change notification settings - Fork 23.5k
Closed
Milestone
Description
We have a lot of inconsistency in the current codebase on how we name boolean setters and getters, and especially those we expose to the scripting API.
We should aim at fixing that for 4.0, breaking compatibility where needed. Related to #16863.
Current uses are of the form:
bool stuff = false;
void set_stuff(p_enable);
void set_stuff(p_enabled);
void set_stuff_enabled(p_enable);
void set_stuff_enabled(p_enabled);
void set_stuff_enabled(p_stuff);
bool get_stuff();
bool get_stuff_enabled();
bool is_stuff();
bool is_stuff_enabled();Can also be more tricky if the boolean name is verb, like:
bool process = false;
void set_process(p_enabled);
void set_processing(p_enabled);
bool get_process();
bool get_processing();
bool get_process_enabled();
bool get_processing_enabled();
bool is_process();
bool is_processing();
bool is_process_enabled();
bool is_processing_enabled();I'm not sure what style we should settle on, but it needs to be consistent.
Here's a proposal to start the discussion:
- Name boolean themselves as nouns, e.g.
processinginstead ofprocess, which solves some of the issues shown above. - Use
p_enabledas parameter in the setter. - Use
set_<boolean>for the setter, andis_<boolean>_enabledas getter.
Example:
bool processing = false;
void set_processing(p_enabled);
bool is_processing_enabled();golddotasksquestions, Awkor, MichaelRizkalla, follower, pouleyKetchoupp and 1 more