3 ms·
There are some differences here, but you can't for instance use a string pointer with string functions in go either. IMO The distinction between pointer and opt
by tedunangst 4y ago
There are some differences here, but you can't for instance use a string pointer with string functions in go either. IMO The distinction between pointer and optional is not as vast as people make it out to be.
(But thanks, I overlooked T? conversions inside if.)
- morelisp 4y agoYou can call a value method on a nil pointer and it panics, though, which I think was a mistake.
- akavi 4y agoThe distinction between pointer and optional is not vast. The distinction between pointer and not optional is. The whole idea of optional is to make not optional possible.
- ricardobeat 4y agoNo you can't, but Go will happily de-reference the pointer without a null check, and your "string" will blow up in production: https://go.dev/play/p/7EVa7q6VgIM https://go.dev/play/p/7EVa7q6VgIM
- nemothekid 4y ago>The distinction between pointer and optional is not as vast as people make it out to be. The billion dollar mistake is overblown?