No I'm almost certain that's wrong. Class decorators are just about the same as they were, except now take a second arg.
-
-
By that do you mean returning a NEW constructor? ie `Class => class extends Class{}`? If so yeah, that would be incredibly handy.
-
That's not what HOCs do though. They return a completely different class.
-
Right Class => class extends Class ie they return a NEW class, like connect. Did you reply to the wrong tweet? :)
-
Ah sure. Doesn't *have to* be Class => class extends Class could just be Class => class { /* somehow ref Class */ } either way - NEW class
-
Corollary to the above: this would be a massive breaking change to not only stage 1, but also TypeScript class decorators.
-
Let's take this off Twitter. I approved the change because I didn't know the use case.
-
I'm happy to help in any way I can, wherever :) just let me know
-
This use case sounds pretty valid. Wanna file a bug at https://github.com/littledan/proposal-unified-class-features/issues … to track removal of the unnecessary check?
- 12 more replies
New conversation -
-
-
You can always use a function, but I'd like decorators to largely satisfy the use cases of HOCs
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Following up here -- is there any update on this discussion (constructor replacement) or somewhere I can follow the discussion?
@wycats -
I can't speak for
@wycats, but I believe all decorators proposals allow constructor replacement. The only question is, how ergonomically? -
I believe he said the current proposal requires changes (being worked on) for total replacement.
-
Replacement has a subclass check. Should I eliminate that? Are there other changes to make?
-
Yes definitely. Existing things like
@observer spit back a totally different class. -
Having trouble understanding; doesn't this spit back a different function or the same class?https://github.com/mobxjs/mobx-react/blob/master/src/observer.js#L274 …
-
If I'm understanding correctly, that always winds up here. Note the resulting class Injector does not extend orighttps://github.com/mobxjs/mobx-react/blob/master/src/inject.js#L34 …
-
/cc
@mweststrate - Dan is asking about your observer decorator. - 4 more replies
New conversation -
-
-
Constructor replacement is done in the finisher in the new design. It would be really easy to remove the subclass check.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
