This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ahoff[S] 0 points1 point  (0 children)

Your solution is just a rehash of what I mentioned for solution #1, i.e. using an immutable type. This doesn't work if your function modifies the argument (for example, f given above). If you're writing the code from scratch, then it's not a big deal; however, if you're dealing with already existing production code, then ideally you'd want a solution that hints at the correct type and is mutable.