Re:A Case Against Using CoffeeScript
by jashkenas on Wednesday December 14, 2011 @07:43AM
(#3351585)
That works in Python, because Python has a distinction between an "instance" object, and, say, a Dict. In JavaScript an object is an object is an object -- under your proposed change, what would be the value of "this, in this:
Klass.prototype.method = options.method;> That works in Python, because Python has a distinction between an "instance" object, and, say, a Dict.
Not really, it's trivial to create a dict-like object which allows access to keys as properties, just override `__getattr__`.
> In JavaScript an object is an object is an object
No, objects can have a non-null [[prototype]] indicating it was created from using `new` on a constructor.
> Klass.prototype.method = options.method;
Depends what `options` is.
I don't think that's true: functions accessed via objects could very well be bound to the object (that's what Python does, accessing a method via an object instance returns a "bound method" which is curried with the instance, whereas accessing the same method via the class returns an "unbound method" which requires a class instance as its first argument).