Comment by bpavuk
2 hours ago
> My ideal syntax for function pointers is
this is actually very Kotlin, in Kotlin it'd be `val lambda: (Int, Char) -> Int = { myInt, myChar -> return 69 }`
Zig has also come very close:
const Call2Op = *const fn (a: i8, b: i8) i8;
fn doOp(fnCall: Call2Op, op1: i8, op2: i8) i8 {
return fnCall(op1, op2);
}
> Every language should either have a pipe operator or let you call any function with method syntax
there is a nicety in Zig that may help: `fn1(p1, ...)` is the same as `fn1.p1()`, so `fn2(fn1(p1))` can be unfolded into `p1.fn1().fn2()`
No comments yet
Contribute on Hacker News ↗