Closed JSAbrahams closed 2 years ago
I think that -> and => are a bit too similar.
->
=>
Functions would look prettier I think if they instead used the assign (:=) token:
:=
Instead of:
def f(x: Int, y: Int := 2) -> Int => x + y
We then have:
def f(x: Int, y: Int :=2) -> Int := x + y
And if we have a larger function (or just want the body on a new line):
def f(x: Int, y: Int := 2) -> Int := def z := x + y z ^ x
Change parser to use := instead and remove the => token from the language (spec).
The arrow is nice in lambda functions though, hm.
An alternative would be def f(x: Int, y: Int := 2): Int => x + y
def f(x: Int, y: Int := 2): Int => x + y
Current Issue
I think that
->
and=>
are a bit too similar.High-level description of the feature
Functions would look prettier I think if they instead used the assign (
:=
) token:Instead of:
We then have:
And if we have a larger function (or just want the body on a new line):
Description of potential implementation
Change parser to use
:=
instead and remove the=>
token from the language (spec).