News for hackers. Stuff that matters.
Re:No ifs...alternatives to statement branching in JavaScript by mrj on Friday August 06, 2010 @07:58PM (#1582692)
What if you did? Would it be a better framework? Would anybody care at all?

I doubt it.

This a code style and if you like it, then maybe you use the parts you want. But "micro branching" is still branching and it makes little difference how you do it (except the nod to performance concerns towards the end).

Thinking about code style and readability is useful and good, but this is by no means a common way to code. Beware of excess cleverness. It would be far better to worry about the correctness of the code rather than optimizing for a meaningless benchmark (no ifs).

Re:No ifs...alternatives to statement branching in JavaScript by BoppreH on Friday August 06, 2010 @11:27PM (#1583002)
It would not be for cleverness, much less for optimization (is it even faster?)

For some reason every time I see a condition I cringe mentally. There's something in a "for" loop that makes me uncomfortable and god, using "map", "filter" and micro branching would help a lot.

I'm just thinking of what I would like to see and checking it against the opinion of others.

Re:No ifs...alternatives to statement branching in JavaScript by mrj on Saturday August 07, 2010 @01:29PM (#1583892)
Maybe it's a coding style that suits you then. That's cool.

I just caution against putting it in such simple terms. I hate it when I read code by somebody who latched on to the latest trend and then ruthlessly bent their style to match the new way, whether it made sense or not.

As for performance, it would have to be tested. In some languages with first-class closures, a lot of code like the examples might seriously strain the garbage collector (if present). There might be a ton of young objects to clean up, all the time. That was my only thought on it.