Conversation

Could maybe work for both? If it's irrefutable it's type ascription, if it's refutable it's a pattern check
2
1
I'm not sure it's possible syntactically to have such a polyglot. struct Test; let x = Test is Test; Is `x` a bool or a Test? I just think a pattern/type syntax polyglot with 2 semantics is uhhhhh very not user-friendly
1
4
Maybe "$expr is type T"? Would read pretty well... Although tbh historically "is" in Rust means "coerce to boolean" not assertion... but it might be clear enough since dynamic typing isn't really a thing?
1
1
It just doesn't look like anything you could learn by knowing another part of the language. : is implied by let bindings, fn args and struct fields.
1
6
Still a fan of Scott’s proposal*: abolish the `:` syntax in struct statements in favor of `=` to normalize the meaning of both characters across the board. *in theory at least, it may not be the most practical
2
11
Yeah, I wanted to do this pre 1.0 and we decided it would be too big a breaking change then! Still think it is one of the biggest mistakes in rust’s syntax (or at least biggest mistake with an obviously better solution)
3
9