2 ms·
Both of these parameters can be null, and references cannot be null, so it is not possible to use references directly without losing some functionality. (They
by steveklabnik 6y ago
Both of these parameters can be null, and references cannot be null, so it is not possible to use references directly without losing some functionality.
(They could remove the intos if they wanted to, I agree it feels kind of weird but I'm not actually sure if doing it is better or worse, I am conflicted.)
- Cu3PO42 6y agoIt could very well be Option<&mut T>, though. Personally I think having a 1:1 mapping to the C API is reasonable enough as a first target. It should make porting code easy and referencing the official documentation is probably easiest this way. No matter how many heuristics they apply to make a somewhat more idiomatic mapping, it'll never feel right until it's manually designed to fit with Rust conventions. So I'm okay with it as it is now and can hope for a much thicker abstraction in the future.
- orra 6y agoOption<T> would sensibly solve the nullability?
- steveklabnik 6y agoThere are a few different possibilities, and some of them involve Option, yes. But doing this would still possibly create an annotation burden that the parent is complaining about. My comment was trying to be pretty narrowly scoped to "why not use a reference here." You and your sibling are both right in ways!
- orra 6y agoFair enough, and gotcha. Thanks.