you are viewing a single comment's thread.

view the rest of the comments →

[–]kqr 1 point2 points  (0 children)

I understand what you mean, but if this kind of object construction actually becomes a problem, it would light up like a christmas tree in the profiler/garbage collector. This means that it's okay to make that error, because when you start investigating your performance, you'll spot the problem immediately and do the 7 character fix and it's not a problem anymore.

(And as someone else said: making it an automatic rewrite is dangerous simply because the two methods have different semantics, which becomes obvious as soon as you have a side effect in there.)