Closed pzuraq closed 2 years ago
I'm not comfortable with reifying property descriptors as an independent class element. If we want to give someone a way to modify other descriptor properties such as enumerability, I think we're better off introducing specific keywords or some kind of native decorator that has privileged access to the descriptor internally.
Following this thread, I think this proposal could be generalized to allow defining any type of class element in the class element block, not just accessors. This would add the ability set properties like
writable
andenumerable
on class elements, and could also potentially be a reason to reconsider whether or not a syntactic opt-in is required (since this would be a much more general syntax than just auto accessors):We could also have a much shorter opt-in keyword,
define
ordef
, instead ofaccessor
:I did a quick write-up of what this could potentially look like, it overlaps a lot with this proposal: https://gist.github.com/pzuraq/ae002a0f3e8745b57cd6c046bf9ff89f