tc39 / proposal-decorator-metadata

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use case for `metadataKey` on methods?

bakkot opened this issue · comments

It is not clear to me what use case having per-method metadata objects fulfills. I understand the desire for a class-level metadata, to coordinate between decorators on a class, but not the need for per-method metadata.

Also, isn't the name, placement, and per-class metadata sufficient to get per-method metadata anyway? You would simply key off of all of those in combination, rather than just off of the per-class metadata.

I imagine the point would be consistency between method decorators and a future function decorators proposal, that you could have a decorator that attached metadata to the function object itself to be read by another API.

Seems like something which should wait until the function decorators proposal, then? It makes sense to leave space for it in the API design, but if we think it's only motivated by a later proposal it should be part of said later proposal.