9 ms·
> Exactly, it forces the programmer to think It's a curious feature, the way you've described it. I have virtually no experience with Java so I'm looking at th
by pandler 11y ago
> Exactly, it forces the programmer to think
It's a curious feature, the way you've described it. I have virtually no experience with Java so I'm looking at this from a totally foreign perspective. The authors considers it an ineffective feature because you still have to think about null checks, whereas you consider it an effective feature because it forces you to think about the problem instead of ignoring it.
- Zardoz84 11y agoI remember that somebody try to defend Java because have references instead of pointers so not is necessary to be worried about null pointers .. Ja!
- acaloiar 11y agoI believe the point @jontro is making is that unsafe programming behavior is unsafe without regard to the language's constraints. Option simply makes it more difficult to behave unsafely. Of course a developer can still call .get() when the presence of a value is unknown, but the Option type lets them know they are being careless in doing so.
- the_af 11y agoNo, the author considers it ineffective because you are not forced to think about nulls at compile time. Of course, at run time they will explode in your face, so you still have to consider them eventually. @jontro is saying that proper Optionals make it impossible (or at least, more difficult) to forget about the problem at compile time.