ECMAScript

Darwin Among the Prototypes II: Private Members

Over the years I’ve experimented with many techniques for both class-based and prototype-based inheritance in Javascript. However, the fallout from the Browser Wars coupled with the lack of awareness of prototype-based languages both in and out of the Javascript community together with my background/interest in larger system issues, caused me to shift my focus in 1999 to the ends rather than the means. I was consulting with Web Crossing on using Javascript for their server-side scripting which ultimately led to the development of Community Catalyst. From the server-side, my focus was on community/social network related objects rather than the DOM and built-in language objects.

While most of today’s libraries do some interesting and useful things, fact is if you “define” enough conventions and/or exploit the powerful features lurking under the hood of of the language, you can twist and contort Javascript into doing just about anything. This is both a strength and weakness of the language - it makes it easy to pursue evolutionary paths but at the same time leads to many dead end paths. In future episodes in this saga I’ll explore the evolutionary river Javascript is sailing down in the context of Morphtron and the stack of capabilities it supports. In the meantime, given that prototypes are inherently intertwined with the creation of objects, I thought it would be interesting and valuable for folk to take a closer look at how Javascript objects get made. Doug Crockford and others have in the past few years really provided useful code and clear explanations in this regard so I won’t attempt to reinvent the wheel. What I want to point out is how important it is to understand the facilities currently at one’s disposal - especially given the controversy over Javascript 2.0. As the universe of Javascript grows understanding how to avoid conflicts with other objects becomes more and more essential. The following links should help clarify private members and their uses:

Private members

Private Static Members In Javascript

Encapsulate Your Javascript: Keep Private Methods Private

How to achieve private, public and privileged members in Javascript

Private Instance Variables With Prototypal Inheritance

Private Javascript

A Javascript Module Pattern

Prototypal inheritance

ECMAScript
Resources

Comments (0)

Permalink

ECMAScript 4 As The Next Big Language

Not A Doubt In My Mind 

ECMAScript

Comments (0)

Permalink

New ECMAScript Site

The Language of the Web has a new home.  I haven’t been enthusiastic about many of the changes people have been clamoring for, but the world has evolved and the language needs to evolve as well.  Javascript creator Brendan Eich makes a good case for what’s needed, though I suppose nobody will be completely satisfied.  I am not a big fan of ActionScript but having it co-exist with Javascript is fine by me. Right now Adobe AIR supports that and so Sockets and other system level stuff can be done from Javascript - cool! Both ActionScript 3 and  and Mozilla’s upcoming Javascript 2 are ECMAScript Edition 4 based and will run under the same Tamarin VM.

 See also:

Brendan’s Roadmap Updates

Lambda-the-Ultimate 

AIR
ActionScript
ECMAScript

Comments (0)

Permalink

FireStats iconPowered by FireStats