On Tue Jun 13 09:36:49 2023 +0000, Giovanni Mascellani wrote:
As I said somewhere else, I don't like this kind of control flow too much. Something in the form:
if (condition) { return f(); } // do work
seems to suggest that `f()` is somehow an exceptional or simpler case of the main branch. Here that's not the case: the two branches are essentially equivalent. So I would rather move the main branch in a dedicated helper too and have something like:
if (condition) return f(); else return g();
which suggests symmetry between the two alternatives. Something I would like even more is to add a knowledge of the supported classes directly in `struct method_function`, but that's more complicated so I'm not necessarily pushing for that.
To me readability is more important that a little bit of duplication here. New helper could be used for all buffer objects methods like Load2(), Load3(), Load4(), existing helper is mostly for textures.
Regarding if () {} else {} style, it's nothing but a matter a taste in my opinion. I don't care at all about that part, meaning I'll using whichever is preferred. I'd think more about it being consistent, if there is a broad agreement to use this style, maybe we could add formatting config file to make it clear.