New to Rust, was excited to see Prolog anonymous variables make an appearance. But one thing struck me is the mismatch between variable and function declarations...
let x: i32 = 42;
vs
fn fair_dice_roll() -> i32 { 4 }
It seems the designers missed an opportunity, as the latter could quite easily have been:
With type ascription being optional in some places, I have to wonder if using the colon for both type ascription and fn return type would introduce any parsing/grammar ambiguities.
I personally like the arrow being used for return types as it highlights pretty well what returns stuff. I don't need to track fn definitions or anything when scanning a file - I just need to look for the arrows.
The way I see it, that would mean the function 'fair_dice' has type 'i32'. While in this case it maybe fine, if the function had arguments, it would be ambiguous.
And that's as far as I got as I exited the page scratching my head to write this comment.