Class decorators and async process
Brendan Eich
brendan at mozilla.org
Mon May 25 23:09:36 UTC 2015
Gray Zhang wrote:
>
> It’s OK, I just wait for |this.weapon| to resolve, but then my |hit|
> method becomes async, and everything based on |@inject| property
> should be async, which is not actually what I want.
>
Async can be contaminating, yes.
Sync is out of bounds in browsers, and for Node.js apart from require --
a rift indeed between the two embeddings.
> Is the decorator idea based on extended property descriptors
> actually being used, e.g., with Babel? Sorry if I missed it.
>
> Decorator is now supported with Babel 5.0 and I was trying this these
> days, expecting it could be integrated with our IoC framework, just as
> how Spring works in Java.
>
I thought so; my aside was a note of caution: this descriptor-extension
approach to decorators is provisional, draft-y, and at the last meeting
questioned by enough people on TC39 that I would want to check out
alternatives to see how that affects your async-contamination situation.
Looks like even more static approaches are even more async-unfriendly,
at a glance, but I haven't thought deeply about it.
https://esdiscuss.org/notes/2015-03-24#6-2-decorators
/be
More information about the es-discuss
mailing list