futurescript icon indicating copy to clipboard operation
futurescript copied to clipboard

Add support for ES7 style decorators :)

Open kristianmandrup opened this issue 8 years ago • 2 comments

Since our code should be as clear and concise as possible and avoid boilerplate!

So I'd like to use polymer decorators with FutureScript for beautiful, efficient frontend dev.

@customElement('test-element')
export class TestElement extends Polymer.Element {

    @property({notify: true})
    aNum: number = 42;

    @property({notify: true})
    aString: string = 'yes';

I see that @ symbol is already used for args but always on its own or with number coming after, so I don't see a conflict :) Where would I add this?

Oh wait, I see it used in hanoi.fus example?

hanoi: <>
    if @count = 1
        move[@from, @to]

Does it mean this.from I thought that would be me.from according to docs?

kristianmandrup avatar Mar 06 '17 18:03 kristianmandrup

I have a plan of supporting decorators, but not using @.

zhanzhenzhen avatar Mar 07 '17 18:03 zhanzhenzhen

In hanoi.fus example it's using radical mode, so @ means arguments[0]. In compatible mode @ means arguments.

zhanzhenzhen avatar Mar 07 '17 18:03 zhanzhenzhen