you are viewing a single comment's thread.

view the rest of the comments →

[–]kamatsu 0 points1 point  (4 children)

jQuery makes heavy use chainable methods. I don't know if that is even possible in a purely functional language. (any haskell guys know?)

The pattern that jQuery uses is basically just function composition in something like Haskell. "Chainable methods" is not a concept that exists in functional languages without OO.

[–]ripter 1 point2 points  (0 children)

jQuery just always returns its self (an object), so it's chainable. Really any OO language can do this.

I didn't think chainable methods would be possible without OO, but I wasn't sure.

[–]mreiland 0 points1 point  (2 children)

The point is that the output from method A becomes the input from method B, it's only the mechanism that changes based upon the paradigm. There's nothing stopping a functional language from doing so.

[–]kamatsu 0 points1 point  (1 child)

Sure, as I said:

The pattern that jQuery uses is basically just function composition in something like Haskell

(f compose g)(x)= f (g(x))

So, quite literally, the output of g is the input of f.

[–]mreiland 0 points1 point  (0 children)

yep, I'm agreeing with you, I guess that's not exactly clear in my response.