Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I remember sitting outside a Mountain View Starbuck's with Lars Hansen, then at Opera, and Brendan Eich, then at Mozilla, and listening to Lars explain that he'd lost faith that ES4 was realistically implementable. I think that was the day I knew it was dead.

I spent years working on ES4 and I'm not sorry it failed (namespaces in particular were just a disastrously bad idea). The whole affair was a formative experience for me.



And yet a good part of ES4 been realistically implemented in ActionScript 3 and used by many developers for over a decade.

And those namespaces in AS3 (much simpler than in ES4) I think are quite a good idea, they allow to control what is visible or not and/or to switch which implementation you use.

For example when some AS3 builtins do not support some methods defined later in ES5.1 then ES6 etc.

    ES5 function trim():String
    ES6 function repeat(count:Number):String
So yeah you not gonna use namespaces everyday for everything, but they do have allow to solve specific problems while "programming in the large".


No matter how many years, decades pass, the connections the Internet makes possible never cease to astonish me. Thanks for your work on ES4.


How did namespaces in ES4 differ from namespaces in Java?


In Java you would use packages to group together class definitions

same as with C++, C# where you would use namespaces to do that

aka define the scope of classes

in AS3, the packages are used the same, group collection of definitions, not only classes and interfaces but also variables, constants.

The namespaces in AS3 are used to define the visibility of definitions at the class level, a bit like being able to define your own "public" attribute.

In ActionScript 3, by default the AS3 namespace is open, for example with a builtin like Array instead of using the push() method defined in the prototype, it uses the push() method defined in the AS3 namespace.

See https://github.com/adobe/avmplus/blob/master/core/Array.as#L...

But you also have mode to compile with -ES to not open that AS3 namespace by default.

In ES4, namespaces could do more advanced stuff like namespace shadowing (only a proposal at the time), see https://web.archive.org/web/20070629024201/http://developer....

For AS3, see 1.9 Namespaces / 12 Namespaces / etc. https://github.com/as3lang/ActionScript3/wiki/Specification


My recollection was that there were modules, packages, and namespaces. Which was kind of a problem.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: