Hacker News new | ask | show | jobs
by niconii 4028 days ago
I think you may have misread that RFC. With my emphasis:

> Here is a list of limitations with the current bounds syntax that are overcome with the where syntax:

The list is of the limitations of normal bounds, not the limitations of where clauses. This was actually the RFC that added where clauses, and that list was the rationale for doing so.

1 comments

Oh... well that's embarrassing.

So, I half-remembered the actual problem I ran into and found something that half-looked like it mentioned it. Not my finest hour :S

I dug up the IRC exchange for the problem I actually ran into:

    jamii
    How do I write the type of a byte iterator:
    fn next_path<N: Iterator>(nibbles: &mut N) -> u32 where <N as Iterator>::Item = u8 {
    That gives me 'equality constraints are not yet supported'
    FreeFull
    jamii: <N: Iterator<Item = u8>>
Equality constraints seem to still be unimplemented ( https://github.com/rust-lang/rust/pull/22074) but I can write this instead

    where N : Iterator<Item=u8>
So that whole section of the post is incorrect. I've removed it and linked to this discussion instead.
I'm the author of the above pull request (as well as other pieces of where clauses), unfortunately there are some internals that need refactoring before we can complete equality constraints, and they weren't the highest priority before 1.0 especially since you can encode a trait that acts in the same way. I'm starting at Mozilla for the summer next week and hope to fix a couple of the outstanding issues around them and associated types.