> OK, I'll bite.
> On Sun, Mar 25, 2012 at 2:23 AM, Neal Gafter <neal@...> wrote:
> > The C# compiler goes to a tiny bit of trouble to make it so that in some
> > cases when you evaluate the very same lambda expression twice (not
> > twice, but written once and evaluated twice) you get the same object.
> > you can't rely on it.
> Um, why?
What is your question? Why does it do that, or why can't you rely on it?
> What's the rationale for having a feature which only works some of the
> time, and
> furthermore seems to only work in cases that overlap a lot with "cases
> would try out, and then draw entirely wrong conclusions from"?
The "feature" is to generate more compact or efficient code when it is easy
to do so. We do that because it improves the performance of programs
written by our customers. Solving the general problem is not possible,
which is why we don't always collapse equivalent lambdas.