3 ms·
Very confused by the example of the "pin" operator given here - what is it for, and what is the improvement in this release?
by maxfurman 5y ago
Very confused by the example of the "pin" operator given here - what is it for, and what is the improvement in this release?
- dangerbird2 5y agoDefinitely not a clear description, but I believe it stands for "pattern matching in". Ruby's new pattern matching uses a sytax of case {{ value }} in {{ pattern }} {{ code }} ... end the new feature apparently allows expressions, rather than just local variables, in the pattern spec. They probably should have included the link to the feature ticket: https://bugs.ruby-lang.org/issues/17411 https://bugs.ruby-lang.org/issues/17411
- Lammy 5y agohttps://docs.ruby-lang.org/en/master/doc/syntax/pattern_matching_rdoc.html#label-Variable+pinning https://docs.ruby-lang.org/en/master/doc/syntax/pattern_matc...