There's a combination of things going on here:

1. There has been discussion on ESDiscuss[1] of __proto__ and the
insufficiencies of Object.create, specifically when you want to set the
__proto__ of something other than an Object (e.g., Functions, Errors,
Arrays, etc...). I don't know what the current state of this feature is,
but I know it at least has been raised and acknowledged as a gap in
functionality that __proto__ fills[2,3].

2. I was mistaken earlier when I said Function.create would be insufficient
for my use cases (and thus would require `fn.__proto__ = ...`). In fact, in
both of my use cases I am setting the proto of functions I have created,
and therefore a Function.create (where it to exist, see the next point)
would be sufficient.

3. Regarding times where I may want to assign the proto of objects,
functions, arrays, errors, I don't own, I personally don't have a usecase
ATM, but I can easily imagine how that would be incredibly useful for any
type of library that shims, wraps or augments core or any built-ins to
extend their functionality seamlessly. If these sorts of libraries don't
already exist, I would hate to unnecessarily break the requisite
functionality before they have a chance to.

Cheers,
Adam Crabtree

[1] http://esdiscuss.org/topic/function-create
[2]
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
[3]
http://perfectionkills.com/how-ecmascript-5-still-does-not-allow-to-subclass-an-array/


On Tue, Sep 24, 2013 at 11:58 AM, Rick Waldron <[email protected]>wrote:

>
>
>
> On Tue, Sep 24, 2013 at 1:34 PM, Adam Crabtree <[email protected]>wrote:
>
>> Object.getPrototypeOf would not help me at all since it would not allow
>> me to assign a *new* __proto__ to a function I just created, but I *am*
>> mistaken, Function.create() would be sufficient in my cases.
>>
>> There's still more flexibility in __proto__ to reassign __proto__, which
>> Function.create and Object.getPrototypeOf would not provide.
>>
>
> I'm certain you mean Object.create, but otherwise I understand where
> you're going. Though this point was clear in your previous message, I'm
> still interested in understanding what circumstances your program is in
> where it needs to re-assign the [[Prototype]] of objects it doesn't own.
>
> Anyway, the solution you need is Object.setPrototypeOf(), which is
> specified for inclusion in ES6.
>
> Rick
>
>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Better a little with righteousness
       than much gain with injustice.
Proverbs 16:8

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to