-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could symbol be added to the prototype instead of instace ? #25
Comments
I think it can! However, while it will increase instances creation performance, it will decrease isX invocation performance, as it will have to fallback to the prototype. Not sure what to do here. |
Sorry I submitted this in a rush, and forgot to provide more context. The reason this came up is I'm having to do this nasty bit of a hack: https://github.com/ipfs/js-ipfs/pull/3081/files#diff-833dfdb70fcd89365dc3bddf93f78e7eR57 Which is needed because once CIDs cross thread boundaries their prototype chain is lost. Code under the link restores those prototype chains. However in case of CID turns out it is not enough because When I started looking into this, I got wondering why that field is set on instance vs prototype and created this issue. I'm not sure if moving symbol field is a best or adequate way to get rid of that nasty code I've linked to, but that was my immediate thought. |
@Gozala probably better to remove class-is and just use |
@hugomrdias remove from where ? All of the code base ? |
I was suggesting cid |
@hugomrdias sorry I'm not sure I understand what you mean by:
Remove class-is from |
Another alternative could be to set it on both prototype and instance. |
Keep the api just without class-is, implement isCID with instanceof with fallback to validating the components |
No description provided.
The text was updated successfully, but these errors were encountered: