Open
Description
The where clause is compile-time check, it's a great idea. but I think we can make it even more great by add some more functionality to it.
- range check: require port is constexpr implicitly
fn foo(port: usize)
where port <= 65535,
port > 1000,
port in 1000..65536 // or this one, much better
{}
- make it general purpose
let foo = 1..500 where _ % 4 == 0 // something like this ( _ maybe better with it )
let foo = 1..100 where it % 2 == 0 //ah much better
Motivation
In 1, it will improving some performent and much easier to optimize code, not letting code jump around
In 2, just let where everywhere, I think people will love it
Metadata
Metadata
Assignees
Labels
No labels