|
|
|
|
|
by eastgate
5704 days ago
|
|
I don't think we should refight the question of encapsulation here. Some people think encapsulation-by-convention is adequate, others don't. I'm also positing Crockford-style modules.(Since it's pretty clear from the context that I'm following Crockford, you might assume that I know about the Javascript/LISP connection.) The question remains: is repeated use of "this" this.Mill();
this.Drill();
this.Fill();
simply semantic vinegar, or does it suggest that the object is not doing its job -- or that we need a new object? |
|
Having come from Python to Javascript, I consider this to be explicit and a feature rather than a code smell. I dislike when a language's include constructs dump everything into the local namespace and the `this` is implicit because it means that I can't look at a piece of code in isolation without IDE support and figure out where a particular reference is resolving.
If it really bothers you, coffeescript uses @ in place of this: