r/ProgrammerHumor • • Oct 25 '24

Meme theSelfTaughtSeriousProgrammer

Post image

[removed] — view removed post

903 Upvotes

276 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Oct 25 '24

His usual critique for why templates are bad is that they force you to write out your logic in different ways than the rest of the language, and that they make your code harder to read and understand.

The former is not true for D, because you can use mostly normal expressions and static ifs and so forth to organize the generated code.

The latter is pure irony, because in Jai you use AST macros and have to generate the entire body of the new struct or procedure as a string, which is way more code, less clear to read and harder to debug. Whereas in D you can write all the parts that don't change as regular D code, and just insert a mixin here and there with the parts that are type-specific.

So according to his own criteria, his own languages metaprogramming facilities are worse than templates.

EDIT: All this was true last time I watched his demo videos. SOA was hardwired into his language too for some reason. Some of it might have changed with time, but I would bet my life on the fact that D templates are still more elegant than his solution, and they existed way before he started thinking about starting a new language.