News for hackers. Stuff that matters.
Re:Array.js: A better array for the browser and Node.js by kybernetikos on Friday February 15, 2013 @07:00PM (#5229569)
The way I did it was to write lots of functions that take e.g. an array (the same approach works for other things) as their first argument, then a function that I called unbind which converts a function of x arguments into a function of (x-1) arguments where the first argument is replaced with the this pointer. Then you can have a function ('bless') that copies all of those 'unbound' functions onto a real data object or prototype. That way you get the best of both worlds and it's up to the user as to what they bless.

The other aspect to this of course is that using es6 proxies, the library could have been made to behave exactly like the native array even without using one.

There are no comments on this comment yet.