3 ms·
In javascript you can rebind functions to any context without explicit self in signature. I admit this (PNI) was deeply confusing at first but I tend to prefer
by agumonkey 12y ago
In javascript you can rebind functions to any context without explicit self in signature. I admit this (PNI) was deeply confusing at first but I tend to prefer this way now. It feels a simpler and more general abstraction.
- panzi 12y agoBut then getting a reference to a bound method is simpler in Python: bound_method = object.method In JavaScript one would have to write: var bound_method = object.method.bind(object);
- panzi 12y agoAlso for unbound methods to make them usable as functions. Python: func = Foo.method JavaScript: var func = Function.prototype.call.bind(Foo.prototype.method);