Looks interesting, especially in concert with the proposed bind syntax. Fortunately, that syntax is in Babel now, so we can play with these ideas straight away. That being said, the readme did not address why Ramda uses the data as the last parameter and not as `this`: To facilitate partial application.
Ramda actually uses data as the last parameter usually, whereas lodash has it as the first. However, I agree, the readme doesn't quite show the full power of Trine. Trine has `partial`, which allows you to do partial application as so: `parseInt::partial(_)`, that would create a function that acts as parseInt but only takes one argument. This is in sync with the partial application syntax proposal: https://gist.githu…
Trine – A utility library for functional programming in JavaScript
41–50 of 116 posts
Re: Trine – A utility library for functional programming in JavaScript
#42I recall lodash author saying that if you want HOF, Datum order to change you can `rearg` the whole library to suit your needs. Maybe the performance penalty is too large, I never tried it.
Re: Trine – A utility library for functional programming in JavaScript
#43Re: Trine – A utility library for functional programming in JavaScript
#44Re: Trine – A utility library for functional programming in JavaScript
#45Perhaps what programmers of modern JavaScript should be doing is going back and revisiting things that have been considered harmful practices for quite a while. Some work in extending prototypes would make a huge difference to the readability of lots of code - yet everyone is told this is a bad practice because extending DOM elements is problematic and people are lazy when it comes to global namespace pollution. Real…
Extending prototypes seems like a great idea, until other code running in the same environment does it, and you realise why people stopped doing that.
Re: Trine – A utility library for functional programming in JavaScript
#46About halfway through the README, after some examples of the new bind syntax, it says "But why stop there?" Actually, please can we stop here? Just for a bit? This continual, persistent mangling of JavaScript's syntax really is starting to hurt. It's one thing to have to keep on top of the new frameworks springing up every five minutes - which you can, for the most part, ignore for at least six months until they star…
Off the top of my head, other languages that are considering and implementing syntax extensions include Python (e.g. "yield from"), C# (e.g. "async/await"), and Java (lambda expressions).
I actually think that it's pretty low to accuse ECMAScript of "mangling" JS syntax when they are just trying to add modern extensions that make common patterns easier. Of course this function bind syntax is just a proposal and hasn't been accepted into the standard yet. But what about it bothers you so much? What about iterators or shorter function definitions, are those also nightmarish manglings of syntax? I mean, really. The usage of Javascript is evolving from simple embedded scripts to gigantic client/server applications. It's no surprise that the language itself will evolve as well.
Re: Trine – A utility library for functional programming in JavaScript
#47Looks like some kind of LINQ implementation for JS.
Re: Trine – A utility library for functional programming in JavaScript
#48Earlier quoted context omitted.
Extending prototypes seems like a great idea, until other code running in the same environment does it, and you realise why people stopped doing that.
[deleted]
Are you checking every single library you use for prototype changes, including the libraries each library depends on, the libraries those depend on, etc.?
Re: Trine – A utility library for functional programming in JavaScript
#49Earlier quoted context omitted.
Extending prototypes seems like a great idea, until other code running in the same environment does it, and you realise why people stopped doing that.
[deleted]
I've been there, and once you start to see random debug logs popping up in your console because you somehow ended up iterating over a `enumerable` prototype extension in a string "enhancement" library used by a third party module, that is used by a third party module. You'll end up having to take one of three choices: Either modify your code to deal with the mess, contact the author of the string library to fix it (and all upstream authors to update their dependencies) or just drop the top level library altogether. None of these are perfectly clean / easy and in some cases these might they might also be impossible (author cannot be reached, won't change his code, you code can't handle it or you simply cannot drop the third party dependency).
Once you start writing a library, you got quite a bit of responsibility resting on your shoulder to not break things upstream :)
We already averted the "nightmare" of io.js / node.js ending up with different ES6 feature sets, so we shouldn't open a new can of worms.
The Node.js ecosystem is wonderful and that in big part stems from the fact that you can basically install any module at any time and things just work.
Re: Trine – A utility library for functional programming in JavaScript
#50Fucking lol, why?