kkirby / gorillascript

GorillaScript is a compile-to-JavaScript language designed to empower the user while attempting to prevent some common errors.
MIT License
5 stars 2 forks source link

If the first argument is a function definition. #2

Closed unc0 closed 9 years ago

unc0 commented 9 years ago
set-timeout #
  console.log 'test'
  , 500_ms

It won't compile.

set-timeout (#
  console.log 'test'
), 500_ms

It won't compile.

Here is my proposal:

set-timeout #{
  console.log 'test'
}, 500_ms
kkirby commented 9 years ago

There is actually a syntax that does work:

setTimeout(
    #
        doSomething()
    1000
)

If you provide the parenthesis, GorillaScript will treat each new line as an argument without the use of commas.