top | item 8907873

(no title)

iwince | 11 years ago

They are a step backward. They try to make a complicated thing look simple. That is always a mistake.

discuss

order

phamilton|11 years ago

I think that is true in the case of forEach loops. However there are plenty of other situations in which the lack of lambdas has made something simple far more complicated. One example is the Strategy Pattern. With lambdas it's a fairly simple thing. Without lambdas there are a bunch of hoops you have to jump through.

Additionally, I feel that lambdas enable constructs that are much clearer and easier to reason about. Consider the case where you want to transform ever element in a list and produce a new list. Without the map function (which depends on lambdas) the logic wouldn't be that bad, you would create an empty list and append each element ad they are processed in a for loop. However, the intent of your code is less clear. Add in filtering and the intention of the code in your for loop ends up quite a bit harder to understand compared to a fairly straightforward select and map.

mekaj|11 years ago

It's not always a mistake. Abstraction has a purpose. The key is using abstractions that are helpful.

Some people find the concision of lambdas helpful, so it's not necessarily a mistake.