Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Autobind decorator #138

Open
barmaglot92 opened this issue Sep 15, 2017 · 2 comments
Open

Autobind decorator #138

barmaglot92 opened this issue Sep 15, 2017 · 2 comments

Comments

@barmaglot92
Copy link

Hi, why you didn`t use .bind for autobind decorator. So why you use WeekMap and so complicated realization?

@jayphelps
Copy link
Owner

It does indeed use .bind if it's available.

Creating a truly universal autobind decorator is harder than one thinks. There are numerous edge cases that have been found over the years, one of which is when you autobind a method that calls the same method on the super prototype and that method was also had used autobind

I try to include brief descriptions in the online comments about why things are done

// Autobound method calling super.sameMethod() which is also autobound and so on.

@jayphelps
Copy link
Owner

More insight into the super.sameMethod() problem needing WeakMap #20 and #21

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants