CrowdHailer / fn.js

A JavaScript library built to encourage a functional programming style & strategy. - http://eliperelman.com/fn.js
MIT License
399 stars 30 forks source link

Question/Enhancement: Add functional datastructures #8

Closed landau closed 10 years ago

landau commented 10 years ago

This is library seems like a good start to push people to program their js more functionally. +1 to that. However, I think if you truly want to push people in that direction you should consider adding some classes like ConsList, Vector, etc.

var list = new ConsList([1,2,3]);

I'd be happy to start contributing some of theses classes.

What is the plan for browser support? Using defineProperty can help make these structures less likely to be mutated by evil.

eliperelman commented 10 years ago

I am cautious to introduce things into the library that involve state-based mechanisms or object-oriented paradigms. I am, however, completely open to a discussion on the topic if the community feels there is value in such a pattern that can still be utilized through functional techniques.

landau commented 10 years ago

Cool. I don't know if it's worth the implementation overhead as well. Now that I think about it, it probably doesn't belong in fn.js directly. Instead a module, ie ConsList, could implement methods around fn.js.

eliperelman commented 10 years ago

I think having this in userland makes a lot of sense. If you happen to put something together that utilizes fn.js, I'd love to see it.