you are viewing a single comment's thread.

view the rest of the comments →

[–]fschmidt[S] 4 insightful - 2 fun4 insightful - 1 fun5 insightful - 2 fun -  (0 children)

I missed this and I want to respond to it. First, Javascript is not used primarily as a functional language. Javascript's functions aren't really functions, they are closures. The difference is that closures have state while functional languages are stateless. I would describe Javascript as a table/closure language like Lua and my Luan. Javascript "objects" are misnamed and are really tables (maps). Javascript's object-oriented features have always been a grotesque hack.

If I want to sum an array in Luan:

local sum = 0
for _, v in ipairs(a) do sum = sum + v end

More verbose than:

local sum = reduce( a, function(x,y) return x+y end )

But the first is clearer to me and is more efficient.

I haven't followed tech ideas in about 20 year since they are all crap, but I do hear mentions of this asych stuff which I assume is some glorified map-reduce. Anyway, there is no valid reason to handle DB requests this way, they should just be done sequentially (in a civilized multi-threaded language). There are valid use cases for map-reduce like gathering a lot of HTTP requests, but this is rare and so this should be as verbose as possible to make clear what is happening.