beercss / beercss

Build material design interfaces in record time... without stress for devs... 🍺💛
https://www.beercss.com
MIT License
937 stars 47 forks source link

#287 replace forEach() with native for-loops #288

Closed coffeeandwork closed 1 month ago

leonardorafael commented 1 month ago

Nice!

laurentpayot commented 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:

coffeeandwork commented 1 month ago

What?? What are the benefits of for loops compared to forEach? forEach is more declarative and has a terser syntax than a for loop, am I wrong? Is it faster? If yes by how much? Ideally we should use map to avoid side effects but I digress... Can someone tell me how for loops are an improvement over forEach?

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.

leonardorafael commented 1 month ago

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