by hax0ron3 · 2w ago · 0 comments
That was, and still is, rare! And in a time without type checking and bundling, it was vital. Match your parentheses and quotes, and your jquery code might not find what you want, but it would (likely) not throw exceptions.
For those unfamiliar, I recommend looking at https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast... and searching for the 201 instances of
: this
in that file. A remarkably fluent API. We could all be so elegant.That'd be an interesting alternative reality!
What ended up happening is that I'm writing (having it written by agents) react like everybody else.
I had to use it on a legacy site recently and forgot how nice it was and it all just came back to me too. Didn’t need docs either. That’s a sign of a very well designed lib
A TC39 Stage 2 proposal adds this into the language itself with the pipeline `|>` operator. [2]
Maybe not precisely the same from a technical point of view but is it just pendantry to argue against someone referring to it as a fluent interface? Happy to learn and to be corrected if required.
|> docker.listContainers() filter(x => x.name == “something”) first getNetwork getIpAddress toString ping
(ignore that some of these should be chained and some should be arguments, I haven’t read the proposal fully)
They’re doubly nice in Clojure because of the lazy evaluation. You can map a pipeline over a list and it will evaluate one at a time rather than pre-evaluating and allocating memory for the whole thing.
Which true is not per se fluent interfaces, but it reads similarly.
And "fluent" -- as the name suggests -- has a lot to do with how it reads, left-to-right with no intermediate variables.
$('#selector').html('new <strong>text</strong>').attr('foo', 'bar');
They have the small surface area of jQuery, but still aim for component-based reactivity and SSR-when-possible which just aligns more with the mental model and development preferences that have developed from the whole world of React/Next and similar.
I'd still recommend keeping it at a minimum though. Rather rely on tools like htmx.
If you intentionally don’t use a library or framework, humans generally eventually reproduce one, often very poorly.
AI doesn’t even try, it just slops and barfs and writes until something works
But to answer your question: Easier to read, easier to write, easier to understand.
code has to be human centric and not influencer centric. Awww, this is not so chic anymore. If you use this you are a peasant, BUT if you use this, well, you are king.
Jquery is only not relevant if you're living in a tech bubble that demands that "new, shiny" is the only thing that could possibly be relevant.
But still everywhere!
Software has a way of sticking around.
I hope https://github.com/tc39/proposal-pipeline-operator and perhaps also https://github.com/tc39/proposal-do-expressions will put it to rest.
jQuery made the decision to do this, not JavaScript.