Hacker News new | past | comments | ask | show | jobs | submit login

I really like Rust, and what it enables, but this seems like a wonderful counterexample.

For a practical programmer, bsearch is on a sorted array. Implement that, with the necessary type abstractions. So: build the objects into an array of references, sort that, then bsearch it already. If you need to keep that array around, do that. Way easier to look at the code and be reasonably confident that it's ok.

Anything else is fobbing off the abstractions to something not-nearly-obvious ( eg, a 'Mid' trait?). I disagree that this is a defect in Rust.

But I suppose that enabling this kind of misabstraction may indeed be a defect in Rust.

Sound an awful lot like Fermat: "the truly marvellous proof which the margin is too narrow to contain".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: