Insane in the membrane!

(I’ve been wanting to use this blog title for months. Insane in the brain!)

Over the last year, I’ve been experimenting with JavaScript proxies and the concept of a “membrane”. (Tom van Cutsem has a nice introductory write-up.) The idea of truly private properties in JavaScript is just so compelling…

… and such a waste of my time.

The hard truth is I’m spending so much time chasing this ideal that I forgot the API I’m working with is unstable as all hell, and sooner or later, it is going to change. Given that latter requirement, and that my planned code design now has a very fragile choke-point on it, I’m going to bite the bullet and admit that building a membrane now, when I have only pieces of the design that’s going to use it, was a pretty bad idea.

What I should’ve done – and what I will now do – is to create a stub membrane with nothing more than “forwarding handlers” between the code I’m prototyping, and the code which exercises it. Most critically, I want to turn that membrane off when I’m doing development. Later, when I need a real membrane, I’ll have a single isolated place to start with. When the API does change, it’ll be in one place to fix.

I have good weeks, and I have bad weeks. Oh, well.