As stated in my sibling[0] to your comment, the developer may have limited ability to fix it, since its a preference the system will often override. That said, its literally a one line change to implement it (for each view controller class), so there is little reason for them not to put it in, even with its limited effectiveness.
> reading https://news.ycombinator.com/item?id=35133241, the plan is to change that. I fear that, by the time they get around to that, lots of code will handle the cases null and Optional containing null differently, making that a breaking change
The post your link links to explains exactly how they intend to avoid this problem.
Actually, https://news.ycombinator.com/item?id=30588362 has convinced me this wouldn't necessarily solve the bug in question either, since it's a bug caused by (quite legitimately) re-using an existing value. Though it would be easy to implement a "free" operation by just writing `undefined`, so it would still help quite a bit, and more than suggestions like "just use an Optional/Maybe type".
I really appreciate you taking the time to look into this! I don't have much more to say right now than what I said to this person: https://news.ycombinator.com/item?id=30742704. I need to dig into it and see. What you've written will help. I might introduce unit tests (with visuals) for this so I can sure it works in a lot of different scenarios.
I'm not sure if it's fair to give it buggy code, but I just changed set(b) to set(d) in the example, and it doesn't realise there's a problem: https://whatdoesthiscodedo.com/g/517c50a
It's not making any claims about the quality of design in JS here. I'm literally not talking about them in the same sentence for this reason. I'm, instead, merely noting that it had the same issue. Looks like it was fixed in 2014: https://nullprogram.com/blog/2014/06/06/ C# also had the same issue, as noted elsewhere in the comments.
[0] https://news.ycombinator.com/item?id=33781895
reply