Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Prototype properties :( #3

Closed
bathos opened this issue May 30, 2017 · 2 comments
Closed

Prototype properties :( #3

bathos opened this issue May 30, 2017 · 2 comments

Comments

@bathos
Copy link

bathos commented May 30, 2017

If I understand correctly, this proposal has succeeded the Orthogonal Classes proposal. Unlike that iteration, which allowed non-method, non-accessor properties of all three targets to be defined within a class body, this seems to omit prototype properties — i.e. post-declaration Object.defineProperty(Foo.prototype, ...) will still be required.

I found the reasoning behind this change at https://github.com/littledan/proposal-unified-class-features/blob/master/DETAILS.md#type-implies-placement

Not that it counts for much but ... I wish it weren’t so. I have used non-method value properties on prototypes often enough to think this is a weird hole; they're useful in particular for inheritance cases where only a subset of instances needs a dynamic value or a subset of extended classes have a different value.

@littledan
Copy link
Member

This proposal leaves the door open for prototype properties, actually. The logic explained in @jeffmo's presentation is that it's more about "default placement"--methods have default shared placement, and fields have default instance placement, but potentially, the opposite of both could be achieved with (optional) own and shared keywords. I'll update the proposal-unified-class-features document to explain this logic.

@bathos
Copy link
Author

bathos commented May 30, 2017

Ah, that’d be a pretty sweet best-of-both-worlds solution. I’ll close this since it’s not really an issue proper & it is reassuring to see that this wouldn't shut the door on "full package" syntax for class bodies.

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