tc39 / tc39/proposal-decorators

Suggestion: Allow function names starting with @

Open
#577 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
3k
Forks
117
PR merge metrics
No merged PRs in 30d

Description

Considering the @reactive decorator, its usage is very clear: @reactive accessor value.

However for the definition it is not that clear:

function reactive(target, desc) {
  // ...
  return { get, set, init }
}

It may looks more confusing if the decorator itself takes arguments.

So if it can be defined with a @ prefix in its name then everyone knows it is a decorator:

function @reactive(target, desc) { }

And this also allows decorators and normal functions share names:

function @foo () {}
funcition foo() {}

foo() // function foo is called

@foo // function @foo is chosen because it is more specific. 
bar

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the decorator syntax and function examples in this issue, then compare the proposed @-prefixed names with the current decorators proposal. No files or tests are identified; done would require a decided syntax and its interactions with ordinary function names to be specified in the proposal.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.