@buherator Could you please elaborate what you'd rather see? imo, if-let and let-else are perfectly reasonable keyword combinations, combining a refutable match with a assignment. Without these constructs, assignments can only be irrefutable patterns.
if-let - run the block if the let assignment matches the refutable pattern
let-else - run the else block if the let assignment doesn't match the refutable pattern. the else block has to diverge (can only evaluate to the ! type aka "never" type)
refutable pattern: a pattern which might not match, such as the pattern Some(val) matching against a Option<u8>
irrefutable pattern: a pattern which always matches, like a simple name, or a tuple pattern matching against only that tuple (unpacking the tuple)
considering this, what keyword would you propose? how would you express "refutable pattern matching assignment" as a longer yet not overly verbose keyword?
also, the & just means "reference", and i haven't had that mess with searching for a error
https://tech.lgbt/@risottobias/113724437738947086
I would suggest verbosity and not overloading a line with multiple things.
even when rust tries to be slightly readable, it basically becomes brainfuck. https://github.com/asterinas/asterinas/blob/main/kernel/src/fs/ext2/fs.rs#L54
(brainfuck hello world: ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.)
it's not even that rust contains an annoying amount of extra descriptive punctuation that is highly relevant to the error (compared to, e.g., typescript which says things like const),
it's that it overloads a line's return value several times over like overusing ternaries.
yes, condition : true ? false; is succinct, but it is not maintainable.
@laund @buherator a criteria for maintainability would be something like:
if your line has an error, it must be at most in one of two punctuation spots (like := vs =), or maybe one of 3-4 keywords.
any language that encourages massive one liner truncation is asking for an error somewhere along character 80 which was supposed to be a | instead of .unwrap()
because .promise().unwrap().must().shift_left().catch() is soooooo readable...