I started designing unit tests and quickly realized we'll need closures
to make unit tests ergonomic and easy to write. So, closures.
I think there should only be one syntax for declaring a function,
whether it's named or anonymous. I like how Javascript lets you do this
with const myFunc = (x) => {x+1}. We should take inspiration from
that.
Ny new syntax for declaring a function is like this:
(params -> output-type) => expr
If you want to bind this function to a name, just do so!
myFunctionName = (params -> output-type) => expr
Both named and anonymous functions can have type annotations, or omit them and let the compiler infer them.
View the rendered markdown
I started designing unit tests and quickly realized we'll need closures to make unit tests ergonomic and easy to write. So, closures.
I think there should only be one syntax for declaring a function, whether it's named or anonymous. I like how Javascript lets you do this with
const myFunc = (x) => {x+1}
. We should take inspiration from that.Ny new syntax for declaring a function is like this:
If you want to bind this function to a name, just do so!
Both named and anonymous functions can have type annotations, or omit them and let the compiler infer them.