[#115884] Windows Ruby 3.2.2: Non-English character added to Windows Registry String Value — Jay Mav via ruby-core <ruby-core@...>
Hello,
3 messages
2023/12/24
[ruby-core:115596] [Ruby master Feature#20040] Make Hash respond do deconstruct to allow matchting key/value pairs
From:
"matz (Yukihiro Matsumoto) via ruby-core" <ruby-core@...>
Date:
2023-12-06 00:14:16 UTC
List:
ruby-core #115596
Issue #20040 has been updated by matz (Yukihiro Matsumoto).
Theoretically possible, but could you show us a specific use case, please?
Matz.
----------------------------------------
Feature #20040: Make Hash respond do deconstruct to allow matchting key/value pairs
https://bugs.ruby-lang.org/issues/20040#change-105527
* Author: Anonymous
* Status: Open
* Priority: Normal
----------------------------------------
It would be nice to allow pattern matching to work on key/value pairs of a Hash to e.g. find the first entry, or entries where the key is not known.
Example:
```
class Hash; def deconstruct = to_a; end
{a: 1, b: 2} => [[k, v], *]
puts "k=#{k}" # :a
puts "v=#{v}" # 1
{a: 1, b: 2} => [*, [k, 2], *]
puts "k=#{k}" # :b
```
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/