kai icon indicating copy to clipboard operation
kai copied to clipboard

Support anonymous parameters to function literals

Open vdka opened this issue 7 years ago • 1 comments

FuncLit will now include a FuncType. The parser for func type allows omission of parameter names, as such we should allow the FuncLit to still use the parameters through $0 style members. Right now this will crash

vdka avatar Oct 11 '17 00:10 vdka

This would look like:

arrays.Sort(&arr, fn{ return $0<$1 })

where it currently is

arrays.Sort(&arr, fn(a, b: u64) -> bool { return a < b })

Note this would also pair nicely with single ExprStmt's being automatically wrapped in a return making it:

arrays.Sort(&arr, fn{ $0<$1 })

But that needs to be a separate bit of work.

vdka avatar Mar 29 '18 15:03 vdka