Decorators. Any new progress?

Not much new activity in the GitHub repo. The code conciseness (with the underlying features) that decorators offer is to die for!

Ah, thanks!

I see the README says

The class "shape" is visible without executing the code, making decorators more optimizable for engines.

But then it goes on to show that decorators can be used like this:

function modifyShapeOfClass(klass) {
  klass.prototype[Math.random()] = function() { ... }
  return klass

class MyClass { ... }

Does that defeat the stated goal?

From the new README:

The class decorator is called only after all method and field decorators are called and applied.

We can still change the shape of the class:

let propsToAdd = []

function extraProp(_, {name}) {
  return _

function addProps(k) {
  for (const prop of propsToAdd) {
    Object.defineProperty(k.prototype, prop + '_two', { ... })

  propsToAdd.length = 0

  return k

class Foo {
  @extraProp bar = 123

new Foo().bar_two

Does that mean any decorator can still make it impossible to change the class shape? Or another question is, why make something a little more difficult if people are still going to do it?