4 ms·
Please don't fancy functional programming in javascript. Its a powerful paradigm and should be used in a language with powerful compiler.
by imvetri 7y ago
Please don't fancy functional programming in javascript. Its a powerful paradigm and should be used in a language with powerful compiler.
- tom_mellior 7y agoJavaScript compilers are about the most powerful ones out there.
- imvetri 7y agoSorry. I should have shared the example I was thinking of as well. Just my example. [lengthy_array].map(function).filter(function).reduce(function). JS compiler just runs them. A compiler to be powerful to handle such functional programming syntax should also have ability to inline the functions as a single function. the above example could be recompiled as [lengthy_array].array_operation(Three function composed into one)
- tom_mellior 7y agoOh, forgot to answer here. As a compiler developer I'm very surprised by the assertion that this wouldn't be optimized by something like V8 or GraalVM's JavaScript engine. But I couldn't JavaScript myself out of a paper bag, so I don't know how to verify this myself.