DrBoolean / immutable-ext

fantasyland extensions for immutablejs
ISC License
490 stars 19 forks source link

Implement for all immutablejs types #16

Open goodmind opened 6 years ago

goodmind commented 6 years ago

If all immutablejs types are extended from Collection can't we just patch it with fantasy-land methods?

DrBoolean commented 6 years ago

That's a good idea for aliases, but i'd think the implementation differs for most datatypes. In any case, a cool thing to try!

StevenLangbroek commented 5 years ago

I'm not sure what you're suggesting is a good idea. @DrBoolean is obviously right that the semantics differ per class. I think you can find good literature that centralizing logic that should be decentralized leads to all sorts of antipatterns (the least of which is having a single union that handles all cases). It'll become the highest traffic file in this repo and, unless you want a couple hundred line file, will still have to delegate to modules per class, making it something akin to a leaky abstraction...

edit: dig a little deeper before commenting Steven 😞. So this repo lives in a single file, so that concern isn't relevant (not until the repo grows a lot anyway). That being said, that union or switch or whatever structure you use for the logic would still live in Collection.prototype.<methodName>, which would still be a code smell.

I'd still like to contribute, I could whip up a table of structures, the algebrae they implement, some notes so that people can pick them for contribution?