(no title)
exacube | 4 years ago
IMO, copy() is well-designed and the semantics are sensible. I think the other examples in that article are not clear, and the semantics have me second guessing what they're doing.
> Drawback 1: if s is nil, the result sClone is not nil.
I can see how this particular semantic seems an issue, but I think its sensible. If your copy() returned nil and you wanted to use it, then you'd have to check if sClone is not nil first, so that if statement is unavoidable. Instead, it's often safer in practice to check ahead of time.
Sorry again for my tone, it's easy to appear rude on the internet on a late night.
No comments yet.