clojure like protocols

# Irakli Gozalishvili (13 years ago)

I have published a blog post about JS protocol library that implements clojure like polymorphism, which is interesting as it solves typical problems with classes. From my experiment I got a feeling that it may be a much better feet for JS language than classes, so I thought it's worth sharing here.

-- Irakli Gozalishvili Web: www.jeditoolkit.com

# Brandon Benvie (13 years ago)

Maye I'm crazy but this seems like IDL in a more JavaScript friendly form. Not just WebIDL "JavaScript semantics and types friendly", but targeted at "implementation using JavaScript" which is less friendly and requires Proxy wrappers for many/most things like dom.js does. Which is a good thing and I like this.

# Irakli Gozalishvili (13 years ago)

-- Irakli Gozalishvili Web: www.jeditoolkit.com

On Thursday, 2012-03-22 at 17:09 , Brandon Benvie wrote:

Maye I'm crazy but this seems like IDL in a more JavaScript friendly form. Not just WebIDL "JavaScript semantics and types friendly", but targeted at "implementation using JavaScript" which is less friendly and requires Proxy wrappers for many/most things like dom.js does. Which is a good thing and I like this.

Maybe I misunderstand your comment but this does not requires Proxy wrappers, in fact it uses just a simple monkey patching of prototypes using non-enumerable, unique names under the hood. With private names it can be improved even further. Or alternatively WeakMaps can be used to implement all of this.

# Brandon Benvie (13 years ago)

Yeah that's what I was trying to say. This is suited towards use in JavaScript whereas IDL isn't.