On Tue Sep 5 20:52:42 2023 +0000, Zebediah Figura wrote:
I accidentally posted before I was done, but to expand on this: this is a general guideline, but not a hard and fast one. And there are a couple exceptions that often show up. As here "X_from_Y" or "X_to_Y" pattern is one; it's not a verb per se but it still describes an action. The other conventional exception, where we usually *do* name a function after a noun phrase, is generally a simple wrapper for CONTAINING_RECORD. E.g. hlsl_ir_expr(), wined3d_adapter_vk(). But like all things, this is a matter of general guidelines and there are probably other reasonable places where one can give a function a name that doesn't include a verb.
I see that the exceptions you mention don't have [side effects](), so maybe the rule of thumb should be expressed as:
"If the function has side effects, its name should contain a suitable verb."
Pure functions can also have verbs ofc, but they probably would be "get_" or "compute_", if any.