![](https://secure.gravatar.com/avatar/d4db251f6da966f841fc5b1a9822eb56.jpg?s=120&d=mm&r=g)
On 19 Jan 2024, at 09:47, Shiv Shankar Dayal
wrote: Dear Hans, Taco, Mojca and Wolfgang,
I see #define macros and gotos in LuaMetaTex code which is not good coding practice and not recommended. These are my first observations. I have started learning plain TeX so that I can understand the code better and send more suggestions to the list.
Dijkstra’s “GOTO is harmful" article was not nearly as absolute as modern programmers’ mindset. Using more “modern" branching using "if" would not make the code faster, and it would not automatically make it easier to understand either. A thing that is often overlooked these days is that goto statements create a documentation label as well as doing actual program counter update work. The “else” branch of an if-else statement in C does not have that feature, and IMO it makes reading nested if statements more painful than code with a few well-placed gotos. Another issue is that when gotos are used to jump out of a switch statement, that code can usually only be refactored by introducing new helper functions. That will make the code base more cumbersome as well as larger (and therefore slower). In cases where that is feasible, switching to branchless code would indeed help with speed. But not with readability, at all. On the many #define’s I agree it would be nice if as many as possible of the constants would be changed to const variables, as that would help with debugging quite a bit. But in the end, all of it is Hans’ call. Best wishes, Taco — Taco Hoekwater E: taco@bittext.nl genderfluid (all pronouns)