Re:Overview Of Upcoming Rails 7.1 Features Part 1
by orf on Tuesday December 20, 2022 @10:55AM
(#34067635)
I don’t understand the issue - why was it reverted? Are there multiple ways to do pattern matching? Why?
[ Parent
| on HN ]
Re:Overview Of Upcoming Rails 7.1 Features Part 1
by ohbarye on Tuesday December 20, 2022 @11:14AM
(#34067944)
This comment describes well.
https://github.com/rails/rails/pull/45553#issuecomment-11795...
Re:Overview Of Upcoming Rails 7.1 Features Part 1
by orf on Tuesday December 20, 2022 @11:22AM
(#34068055)
I read that comment, but unless you know Ruby most of the specifics are meaningless
Re:Overview Of Upcoming Rails 7.1 Features Part 1
by riffraff on Tuesday December 20, 2022 @01:48PM
(#34070390)
think 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.