# function.bind should inherit \_\_proto\_\_

**URL:** <https://es.discourse.group/t/function-bind-should-inherit-proto/1325>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [April 26, 2022, 1:58pm UTC](https://es.discourse.group/t/function-bind-should-inherit-proto/1325 "2022-04-26T13:58:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thysultan](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/thysultan/32/1343_2.png) [@thysultan](https://es.discourse.group/u/thysultan)\
**Post date:** [April 26, 2022, 1:58pm UTC](https://es.discourse.group/t/function-bind-should-inherit-proto/1325/1 "2022-04-26T13:58:42Z")

</div>

bound functions should share the same prototype as the function they are binding to, for example:

```javascript
const fun = Object.setPrototypeOf(() => {}, []).bind()

```

fun should also have an array as its **proto**

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/senocular/32/642_2.png) [@senocular](https://es.discourse.group/u/senocular)\
**Post date:** [April 26, 2022, 3:02pm UTC](https://es.discourse.group/t/function-bind-should-inherit-proto/1325/2 "2022-04-26T15:02:31Z")

</div>

It does this today. Your specific example won't work because by setting the prototype of your function to an array, it no longer has access to the `bind()` method. But if you did manage to bind it, you'd see that the returned function shares the prototype of the original.

```javascript
const proto = []
const fun = Function.bind.call(Object.setPrototypeOf(() => {}, proto))
console.log(Object.getPrototypeOf(fun) === proto) // true

```

In the spec see steps 2 and 5 in [10.4.1.3 BoundFunctionCreate](https://262.ecma-international.org/12.0/#sec-boundfunctioncreate).

---

<div class="post-metadata">

**Author:** ![thysultan](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/thysultan/32/1343_2.png) [@thysultan](https://es.discourse.group/u/thysultan)\
**Post date:** [April 26, 2022, 4:35pm UTC](https://es.discourse.group/t/function-bind-should-inherit-proto/1325/3 "2022-04-26T16:35:43Z")

</div>

Wow, amazing... i have an api that is hinging on this exact behaviour for performance reasons, good to now it already is and i was just mistaken.

Thanks.
