4 ms·
I don’t understand the issue - why was it reverted? Are there multiple ways to do pattern matching? Why?
by orf 4y ago
I don’t understand the issue - why was it reverted? Are there multiple ways to do pattern matching? Why?
- ezekg 4y agoI think it was reverted because the Rails team isn't sure what values of a model should be available to pattern match, and how each attribute or association should be pattern matched.
- ohbarye 4y agoThis comment describes well. https://github.com/rails/rails/pull/45553#issuecomment-1179568855 https://github.com/rails/rails/pull/45553#issuecomment-11795...
- orf 4y agoI read that comment, but unless you know Ruby most of the specifics are meaningless
- riffraff 4y agothink of pattern matching being implemented via methods on an object which return a hash/array (deconstruct and deconstruct_keys). ActiveRecord objects wrap an hash of attributes, but are also normal objects which have instance variables and methods plus some hooks and specific API that can be expected to be overriden. So it's unclear how the method should behave: just read from the hash? Invoke some specific method? Invoke any method? The answer may be non obvious.
- canadianfella 4y ago