kai
kai copied to clipboard
Support anonymous parameters to function literals
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
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.