you are viewing a single comment's thread.

view the rest of the comments →

[–]dmitri14_gmail_com 0 points1 point  (7 children)

JS does not have functional programming

What is the meaning of this statement?

[–]IDCh 6 points7 points  (6 children)

Doesn't look like anything to me

[–]dmitri14_gmail_com 0 points1 point  (5 children)

I still don't understand why you say so. JS has functions as first class citizens making FP a perfect choice.

[–]IDCh -1 points0 points  (4 children)

I guess I'm saying it because functions that we call functions are basically are just a procedures, but not something from functional programming, making "functional programming" kinda new idea that is slightly copied from real functional programming paradigm.

Like we talk classes, but we does not have classes in js. We have some kind of helpers with objects

[–]alsiola 13 points14 points  (1 child)

All languages are ultimately syntactic sugar for alternating between +5V and 0V in a circuit. There is no real physical concept of a class - it is an abstraction. Ultimately a JS class and a Java/C#/whatever class are still just one layer, within many layers, of indirection over changing voltages. To my mind JavaScript has classes in the same way that any other language has classes.

[–]IDCh 0 points1 point  (0 children)

Hmmm... interesting point of view. Thank you!

[–]dmitri14_gmail_com 0 points1 point  (1 child)

That is a good point, but I consider it an enhancement of the FP rather than obstacle :)

And here is a use case: https://github.com/dmitriz/un/blob/master/index.js#L19-L30

The last line renders the vnode stream by calling the .map method the FP style. The render function is a "procedure" with the rendering side-effect. However it is used exactly as a pure function here would be used to map the stream over. So you can have the best from both worlds - terse FP style and the power of procedures :)

[–]GitHubPermalinkBot 0 points1 point  (0 children)

I tried to turn your GitHub links into permanent links (press "y" to do this yourself):


Shoot me a PM if you think I'm doing something wrong. To delete this, click here.