4 ms·
You could argue that we shouldn't have nullable raw pointers at all and build the Option type into the language, but otherwise I don't think pattern matching on
by ben0x539 12y ago
You could argue that we shouldn't have nullable raw pointers at all and build the Option type into the language, but otherwise I don't think pattern matching on nullable pointers buys you much since you don't need to extract the pointer value for the non-null case and you'd just be using the match expression as a glorified if-else.
- Peaker 12y agoHaving raw pointers be represented as simple pointers, but accessed as if they were wrapped with an Option (or equivalent) could be nice. I agree that if the raw pointer is directly usable whether or not it may be null, then the pattern matching is almost pointless.