4 ms·
> I just also don't have the major disdain for null that the internet seems to send through a massive echo chamber nightly. The disdain is probably (allow me t
by Dewie 12y ago
> I just also don't have the major disdain for null that the internet seems to send through a massive echo chamber nightly.
The disdain is probably (allow me to project) because it is a totally unnecessary problem which can be solved easily with virtually no drawbacks.
- taeric 12y agoHaving worked on some projects that have more bloody optional variables than I can shake a stick at, I wouldn't claim there are no drawbacks. The cognitive overhead of some of them is bloody heavy. Especially if there is poor judgement on when a parameter is optional or not.
- dllthomas 12y agoThat's not solved by making them implicit. Then you need to keep even more in your head!
- taeric 12y agoI prefer to architect the code such that it is only possibly null in one section of the code. For the rest, it should never be null. Pretty much period. Granted, this can certainly be done with optional types. So, I'm not ultimately against them. I just think they are oversold quite a lot.
- dllthomas 12y agoIt's not just that this "can be done" with optional types - this is precisely what optional types are for. And they help make sure you're never mistaken about that "pretty much". Like any tool, people can misuse it (propagating them everywhere would be an example of this, partial extraction functions would be another).
- taeric 12y agoRight, that is essentially my point. I do still hold more pessimism than I probably should, but by and large my main objection is just to the nature with which optional types are sold. They are almost like the vitamins of programming. Great for when they are really needed, probably wasting a ton of time for where many people that just found them put them to use.