There's been some talk from about using that for more ergonomic enum variant checking, so you might need to fight him for the keyword if so
Conversation
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
What about the Golang syntax
_foo.(i32)?
2
1
Thanks! I hate it! 😄
1
4
May I ask why?
(it feels better than the current type ascription,
But I still prefer turbofish for now)
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
I remember your proposal! Every time I have to move a let binding into a struct field and back again I am reminded of it. Hah. 🥲






