No, it's function composition as seen in e.g. pure functional programming languages like Haskell:
(.) :: (b -> c) -> (a -> b) -> a -> c
Except that of course in an impure language like JavaScript if you compose some function f with another function g, either or both functions could have side effects (via I/O, mutation etc.) that break referential transparency.
After a quick glance at the Prototype code, the bind function isn't merely changing which object the name 'this' is bound to, it also allows a kind of currying. However, this still isn't function composition.
Look at the source of what dojo.hitch does or google.bind. It is the exact same thing. Whoever down-voted me obviously doesn't know JavaScript. Voting on comments is such a dumb idea. Popularity does not equal right. Right is simply right.
6 comments
[ 2.0 ms ] story [ 25.3 ms ] thread(.) :: (b -> c) -> (a -> b) -> a -> c
Except that of course in an impure language like JavaScript if you compose some function f with another function g, either or both functions could have side effects (via I/O, mutation etc.) that break referential transparency.
After a quick glance at the Prototype code, the bind function isn't merely changing which object the name 'this' is bound to, it also allows a kind of currying. However, this still isn't function composition.
http://www.google.com/codesearch/p?hl=en#1oUPVh-C1Wg/trunk/e...