grain-lang / grain

The Grain compiler toolchain and CLI. Home of the modern web staple. 🌾
https://grain-lang.org/
GNU Lesser General Public License v3.0
3.26k stars 113 forks source link

Shorthand syntax for supplying a parameter #2149

Open alex-snezhko opened 1 month ago

alex-snezhko commented 1 month ago

It would be nice to have a punning syntax for passing a binding as a labeled argument with the same name

Possible syntaxes:

let add = (num1, num2) => num1 + num2

let num2 = 2
add(1, ~num2)
add(1, num2=)
add(1, num2=~) // (or some other special character)