-
Notifications
You must be signed in to change notification settings - Fork 62
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
using Records where only Objects are currently permitted: [[Prototype]]? #326
Comments
Hi @michaelficarra - were you suggesting that the object coercion here be implicit? i.e. For the implicit conversion, this is different from the implicit conversions added in #264 where the conversion is internal to the methods. e.g. For allowing records to be used as a |
Yes.
That's fair, and I would accept that reasoning. |
Thanks @michaelficarra - I'll close this for now as "converting a record to be used as a prototype should be done explicitly". We can always re-open if discussion prompts. As a side note, I realized I wasn't sure what would happen for const o = {
__proto__: 42
};
Object.getPrototypeOf(o) === Object.prototype; // true
Reflect.ownKeys(o); // [] |
#264 is trying to allow records to be interchangeable with objects in more places. Currently, there is a guard at the beginning of all mechanisms that assign a value to an object's
[[Prototype]]
(such asObject.create
andObject.setPrototypeOf
) that the value isnull
or an Object. Do we want to change these guards to permit records to be added to the prototype chain? A workaround currently is to just pass the record throughObject()
first, as inObject.create(Object(record))
.The text was updated successfully, but these errors were encountered: