{"action":"created","issue":{"url":"https://api.github.com/repos/tc39/proposal-decorators/issues/80","repository_url":"https://api.github.com/repos/tc39/proposal-decorators","labels_url":"https://api.github.com/repos/tc39/proposal-decorators/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/tc39/proposal-decorators/issues/80/comments","events_url":"https://api.github.com/repos/tc39/proposal-decorators/issues/80/events","html_url":"https://github.com/tc39/proposal-decorators/issues/80","id":307427008,"number":80,"title":"Alternative to DecoratorMemberExpression/DecoratorCallExpression","user":{"login":"rbuckton","id":3902892,"avatar_url":"https://avatars2.githubusercontent.com/u/3902892?v=4","gravatar_id":"","url":"https://api.github.com/users/rbuckton","html_url":"https://github.com/rbuckton","followers_url":"https://api.github.com/users/rbuckton/followers","following_url":"https://api.github.com/users/rbuckton/following{/other_user}","gists_url":"https://api.github.com/users/rbuckton/gists{/gist_id}","starred_url":"https://api.github.com/users/rbuckton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rbuckton/subscriptions","organizations_url":"https://api.github.com/users/rbuckton/orgs","repos_url":"https://api.github.com/users/rbuckton/repos","events_url":"https://api.github.com/users/rbuckton/events{/privacy}","received_events_url":"https://api.github.com/users/rbuckton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-03-21T21:36:29Z","updated_at":"2018-04-01T19:34:53Z","closed_at":null,"author_association":"NONE","body":"Instead of restricting _Decorator_ to a custom minimal expression form, why not consider threading a `Decorator` parameter through _LeftHandSideExpression_, e.g.:\r\n\r\n```grammarkdown\r\nLeftHandSideExpression[Yield, Await, Decorator] :\r\n  NewExpression[?Yield, ?Await, ?Decorator]\r\n  CallExpression[?Yield, ?Await, ?Decorator]\r\n\r\nNewExpression[Yield, Await, Decorator] :\r\n  MemberExpression[?Yield, ?Await, ?Decorator]\r\n  `new` NewExpression[?Yield, ?Await, ?Decorator]\r\n\r\nCallExpression[Yield, Await, Decorator] :\r\n  CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await, ?Decorator]\r\n  [~Decorator] SuperCall[?Yield, ?Await]\r\n  CallExpression[?Yield, ?Await, ?Decorator] Arguments[?Yield, ?Await]\r\n  [~Decorator] CallExpression[?Yield, ?Await, ~Decorator] `[` Expression[+In, ?Yield, ?Await `]`\r\n  CallExpression[?Yield, ?Await, ?Decorator] `.` IdentifierName\r\n  CallExpression[?Yield, ?Await, ?Decorator] TemplateLiteral[?Yield, ?Await, +Tagged]\r\n\r\nCoverCallExpressionAndAsyncArrowHead[Yield, Await, Decorator] :\r\n  MemberExpression[?Yield, ?Await, ?Decorator] Arguments[?Yield, ?Await]\r\n\r\nCallMemberExpression[Yield, Await]:\r\n  MemberExpression[?Yield, ?Await, ?Decorator] Arguments[?Yield, ?Await]\r\n\r\nMemberExpression[Yield, Await, Decorator]:\r\n  PrimaryExpression[?Yield, ?Await, ?Decorator]\r\n  [~Decorator] MemberExpression[?Yield, ?Await, ~Decorator] `[` Expression[+In, ?Yield, ?Await] `]`\r\n  MemberExpression[?Yield, ?Await, ?Decorator] `.` IdentifierName\r\n  MemberExpression[?Yield, ?Await, ?Decorator] TemplateLiteral[?Yield, ?Await, +Tagged]\r\n  [~Decorator] SuperProperty[?Yield, ?Await]\r\n  [~Decorator] MetaProperty\r\n  `new` MemberExpression[?Yield, ?Await, ?Decorator] Arguments[?Yield, ?Await]\r\n\r\nPrimaryExpression[Yield, Await, Decorator]:\r\n  [~Decorator] `this`\r\n  IdentifierReference[?Yield, ?Await]\r\n  Literal\r\n  ArrayLiteral[?Yield, ?Await]\r\n  ObjectLiteral[?Yield, ?Await]\r\n  FunctionExpression\r\n  ClassExpression[?Yield, ?Await]\r\n  GeneratorExpression\r\n  AsyncFunctionExpression\r\n  AsyncGeneratorExpression\r\n  RegularExpressionLiteral\r\n  TemplateLiteral[?Yield, ?Await, ~Tagged]\r\n  [~Decorator] CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]\r\n  [+Decorator] ParenthesizedExpression[?Yield, ?Await]\r\n```\r\n\r\nThis allows many more expression forms in decorators while disallowing common footguns (such as `this`, `super`) and ambiguous syntax (such as `@o [x]` or `@() => o [x]`). It also allows the valid set of decorator expressions to grow as the language grows without maintaining two separate \"expression\" forms with similar semantics."},"comment":{"url":"https://api.github.com/repos/tc39/proposal-decorators/issues/comments/377811089","html_url":"https://github.com/tc39/proposal-decorators/issues/80#issuecomment-377811089","issue_url":"https://api.github.com/repos/tc39/proposal-decorators/issues/80","id":377811089,"user":{"login":"littledan","id":189835,"avatar_url":"https://avatars3.githubusercontent.com/u/189835?v=4","gravatar_id":"","url":"https://api.github.com/users/littledan","html_url":"https://github.com/littledan","followers_url":"https://api.github.com/users/littledan/followers","following_url":"https://api.github.com/users/littledan/following{/other_user}","gists_url":"https://api.github.com/users/littledan/gists{/gist_id}","starred_url":"https://api.github.com/users/littledan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/littledan/subscriptions","organizations_url":"https://api.github.com/users/littledan/orgs","repos_url":"https://api.github.com/users/littledan/repos","events_url":"https://api.github.com/users/littledan/events{/privacy}","received_events_url":"https://api.github.com/users/littledan/received_events","type":"User","site_admin":false},"created_at":"2018-04-01T19:34:53Z","updated_at":"2018-04-01T19:34:53Z","author_association":"OWNER","body":"Thanks for this context about TypeScript; it's an interesting approach. I take it the last line there is responsible for permitting parens to be used to contain something with square brackets, right?\r\n\r\nThe syntax in this proposal is deliberately as restrictive as possible, based on a design goal of @wycats : I believe the argument is that, if the syntax is restricted at all, better to restrict it significantly than have a partial expression grammar with edge cases that don't work. This one could be seen as hard to explain. Please get in touch with him if you'd like to relax the syntax (I'm not sure if he'll see the GitHub notification)."}}
{"actor":{"display_login":"littledan"}}