Marco,

The reason Object.create() wouldn't work in this case is because we don't
want to overwrite the native C++ binding functions from the "native"
SlowBuffer.prototype.

We could have gotten away with Object.create() if we 1) save a reference to
the original SlowBuffer.prototype, then 2) overwritten SlowBuffer.prototype
using Object.create(), and finally 3) loop over the original prototype and
copy over all properties manually.

So for brevity's sake, __proto__ wins here.

On Mon, Jun 11, 2012 at 1:17 PM, Marco Rogers <marco.rog...@gmail.com>wrote:

>
>> That option won't work in this case, because we need
>> SlowBuffer.prototype to be the exact same object returned from C++.
>>
>>
> Interesting. Can you elaborate on this? Is it due to the weirdness with
> retrieving the right "this" object when in C++ land?
>
> :Marco
>

Reply via email to