Some questions about Private Name Objects

Irakli Gozalishvili rfobic at
Fri Sep 14 14:34:47 PDT 2012

Hey Dean, 

I also really love clojure protocols and in fact tried to propose few extensions for private names to make them little more usable as such:

Unfortunately thread did not got any replies from anyone.

That being said I did couple of experiments in these area:

Implemented clojure like protocols as library:

But after using it for some time I realised it was not very javascripty,
so I have prototyped a more minimalistic version, which I'm using happily
since then: 

I still really wish we could make private names callable such that:

var method = Name()

method(object, arg1, arg2) => object[method](arg1, arg2)

Irakli Gozalishvili

On Thursday, 2012-09-13 at 14:46 , Dean Landolt wrote:

> The real point I'm trying to make is that Name objects give us something akin to clojure's protocols. Imagine an "orm" protocol -- this is just a set of names that must exist on an object (or its proto chain). An object can implement any number of protocols (or interfaces, or whatever) without fear of conflict. You can easily override any implementation so long as you have a handle on the appropriate name object. This is easier, better looking and more correct than anything we can do today. It's not too disimilar from using using instanceof as a brand, but without the pitfalls (it doesn't fall flat crossing sandbox boundaries). This is a safe and flexible inheritance model that works just as a js programmer would expect, all without begging for mutable or multiple prototypes. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list