News for hackers. Stuff that matters.
Re:How Good C# Habits can Encourage Bad JavaScript Habits by ArbitraryCrow on Thursday May 09, 2013 @08:20PM (#5683785)
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?

Re:How Good C# Habits can Encourage Bad JavaScript Habits by erik14th on Friday May 10, 2013 @02:09AM (#5684866)
In the browser, you have the global scope in the window object o it's pretty easy to define a construct for namespaces.

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.