Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

class decorator export before/after, class expressions, new operator, extends #111

Closed
dnalborczyk opened this issue May 31, 2018 · 3 comments

Comments

@dnalborczyk
Copy link

dnalborczyk commented May 31, 2018

sorry, I don't want to beat a dead horse, but the relating issues were all closed. I was also wondering what the outcome (if there was one) has been from the recent TC39 May meeting.

I noticed the Babel PR babel/babel#7869 to allow decorators before export. I was reading a couple issues about export statements and class expressions, and I wasn't quite sure if a decision has been made. (allow both before/after export, only before, only after?)

Though I'm agreeing that it might be more aesthetically appeasing having a decorator before export, though from a logical standpoint I'm agreeing with @ljharb that the decorator should come before the class definition, just to be logically consistent.

I was also wondering how the new operator and the extends keyword are being handled?

Unfortunately I don't know how to read the current spec, but I was wondering if I should expect the following (more or less) to work - other than eventually some parenthesis to be inserted, e.g. new (@dec class {}) ?

const foo = @dec class {}
const foo = new @dec class {}

@dec class A extends @dec class B {} {}

export @dec class Foo {}
export default new @dec class {}
export const A = @dec class {}
export const A = new @dec class {}
export @dec class A extends @dec B {} {}

if @dec export class ... is allowed, I 'd kinda expect @dec return/yield class ... to work as well, but then, where does it end?

@dnalborczyk dnalborczyk changed the title class decorator export before/after, class expressions, new operator class decorator export before/after, class expressions, new operator, extends May 31, 2018
@littledan
Copy link
Member

Yes, you're right, the decorators-before-export idea was only for export, not return, new or extends.

@littledan
Copy link
Member

This looks like a line of argumentation for #69. Let's continue the discussion in that issue.

@littledan
Copy link
Member

Duplicate of #69

@littledan littledan marked this as a duplicate of #69 Jul 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants