oh and this is another thing sorry but
def ident(Args): Ret
is wrong.
but no language can have perfect syntax I suppose. 😔
Conversation
mmm. I did notice that but the arrow of implication still makes more sense to me, as with in Rust's
let fun: fn(Arg) -> Ret = |arg| arg.val;
1
1
we do use => amusingly, but only for match arms.
1
1
indeed we don't, for whatever reason we decided we like Ruby closures better.
1
1
ohhh yeah we decided fn() was fine for the simple case and for the complex case uhh
so
it turns out
we have three different function traits :D
1
1
FnOnce<Args>
call_once(self, Args) -> Output
FnMut<Args>
call_mut(&mut self, Args) -> Output
Fn<Args>
call(&self, Args) -> Output
2
1
yeah… really screams out for some sort of polymorphism over closure usage… or something like that
hoping languages like Granule can end up figuring this kind of thing out
1
tbh this is fine? because they're all supertraits and because lifetimes, ownership, and mutability matters, you can and indeed must specify the strictness of your trait bound, which lets you accept either all closures (FnOnce) or ones that are safe to call repeatedly (Fn).
1
1
Yeah I agree it works fine in Rust, yeah… but I think I'd want closures to be able to support other substructural properties beyond what Rust supports? And then you start getting more and more traits? But yeah I haven't thought it through carefully yet 😅
2
1
Show replies


