Closed coffeeandwork closed 1 month ago
Oh I just read #287 :man_facepalming: So the reason is performance. Ah that’s a good reason for such a syntax trade off then... :neutral_face:
What?? What are the benefits of
for
loops compared toforEach
?forEach
is more declarative and has a terser syntax than afor
loop, am I wrong? Is it faster? If yes by how much? Ideally we should usemap
to avoid side effects but I digress... Can someone tell me howfor
loops are an improvement overforEach
?
I was worried that we are giving up on some of the syntactic benefits that you point out. If we were writing business logic, it's probably not worth it to make this change. It's only worth it because we are writing ui framework code which is low enough in the abstraction layers of any app that uses it.
I'm a lover of readable and small size code. But this makes me to think about it https://github.com/beercss/beercss/issues/287#issuecomment-2057792453
Nice!