zhanzhenzhen / futurescript

A future-style language.
https://futurescript.org/
Other
43 stars 3 forks source link

Add support for ES7 style decorators :) #20

Open kristianmandrup opened 7 years ago

kristianmandrup commented 7 years ago

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?

zhanzhenzhen commented 7 years ago

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

zhanzhenzhen commented 7 years ago

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