3 ms·
Meh. It’s harmless. You get a helpful compiler error the first time and you very quickly learn. I’ve been a C programmer for >20 years and this slight differenc
by xorvoid 5y ago
Meh. It’s harmless. You get a helpful compiler error the first time and you very quickly learn. I’ve been a C programmer for >20 years and this slight difference wouldn’t bother me.
Explaining it is simple:
‘.’ uses a reference and produces a reference
‘->’ uses a pointer and produces a pointer
- heinrich5991 5y ago`.` only produces a reference if you explicitly reference the result. `a.b` is of type `B`, only `&a.b` is `&B` and `&mut a.b` is `&mut B`. This is unlike your proposal of `->` where `a->b` would be `*const B`.
- estebank 5y agoThe problem is not ibvalid.code being rejected with an error, but rather code that is accepted but does something unexpected. Lints can help with that, but that has many limits.