▲ | recursive 2 hours ago | |
Over the years, I've seen a few posts like this that seem to take it as a given that a loop in a normal programming language is better than foreach capability in a template language. Certainly enough times to believe that a significant group of people actually believe it's superior. There's not a difference in capability of expression of the two models. It seems to be a purely aesthetic or comfort difference. I guess different people like different things. | ||
▲ | apsurd 33 minutes ago | parent [-] | |
It's because native programming language will defacto allow you to hack it to its natural limit. A tendency most all programmers have given they even get into programming. For example with any iterator/loop you may want to filter, or find, or transform. in ruby you have the entire Enumerable API to dig into or Array prototype for js. a templating language would have to reimplement functionality one by one in an allow list. it's just fatigue at that point, yet another API i've got to mentally track. edit: of course if you export the view data "clean" before hand it compels you to not have intense logic in the view. I get that but after a decade+ in product, views are never pure, even just ability to highlight the active tab takes conditional and select logic in a loop. |