|
|
|
|
|
by ArbitraryCrow
4782 days ago
|
|
I have very little experience with Javascript. I come from a Python background. So please excuse my ignorance, but this doesn't sound like a designed language feature at all. These look like tricks that programmers discovered they could use to provide namespace separation. Wouldn't it better if there were constructs built into the language to provide separate namespaces, in an obvious and coherent fashion? |
|
I thought about the namespaces thing and it sounds like a better idea than encapsulating stuff into anonymous functions so I made a little boilerplate that implement basic OOP features:
http://jsfiddle.net/L4Tcw/21/
Only thing that I think smells a bit is having to keep a reference to 'this' of the main object.