tech.lgbt is one of the many independent Mastodon servers you can use to participate in the fediverse.
We welcome all marginalized identities. This Mastodon instance is generally for folks who are LGBTQIA+ and Allies with an interest in tech work, academics, or technology in general.

Server stats:

2.9K
active users

@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