immutable-ext icon indicating copy to clipboard operation
immutable-ext copied to clipboard

Implement for all immutablejs types

Open goodmind opened this issue 7 years ago • 2 comments

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

goodmind avatar Apr 11 '18 14:04 goodmind

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!

DrBoolean avatar Jun 22 '18 16:06 DrBoolean

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?

StevenLangbroek avatar Feb 10 '19 19:02 StevenLangbroek