setPrototypeOf vs obj.__proto__ assignment

K. Gadd kg at luminance.org
Mon Apr 7 09:00:45 PDT 2014


Is my understanding correct that __proto__/setPrototypeOf are still
required if you want to do things like that with instances of
Function? Or did Function's constructor finally get patched to let you
set a prototype?

On Mon, Apr 7, 2014 at 2:26 AM, David Bruant <bruant.d at gmail.com> wrote:
> Le 07/04/2014 11:05, Andreas Rossberg a écrit :
>
>> On 4 April 2014 19:49, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>>>
>>> __proto__ is there for legacy compatibility.
>>> setPrototypeOf should be preferred for new code
>>
>> For new code, neither should be used.
>
> yup.
>
> For new code, in most practical cases, people can use class&extend including
> to subclass Array and Date where __proto__ used to be the only way.
>
> David
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list