Results 260 comments of Leaf Petersen

I'm inclined to agree with the analysis from @lrhn above.

> Does that all make sense? It may be that classifying the pattern as "irrefutable" is a confusing term. All that really means is "permitted in irrefutable context". It may...

> When the compiler does have to resort linear scan (with caching #2107), I think that's no slower than the code users would write if we didn't have pattern matching...

> It is technically a breaking change. I would be quite surprised if any significant amount of existing Dart code was affected by the change. I don't understand: if the...

Thinking about this a bit more from the user perspective. We have a choice around how to interpret literal/constant patterns: - We can interpret them as checking identity - We...

> I don't think that current Dart switch can be thought of as checking identity. I can construct a String instance which is not `identical` to a constant String, but...

I feel like there's quite a bit of confusion in this thread - I'd like to really ask folks to take the time to read through the original post and...

@munificent > if we know the types of _both_ the scrutinee and the constant, and that type is a sealed built-in type, then the compiler knows _exactly_ how that `==`...

Here's another way of thinking about it that might be helpful. We **do not** currently define the semantics of `if (b) ...` to be the same as `if (b ==...

@lrhn agreed. And good point that using primitive equality for records rather than identity is probably what we want.