General

Profile

ursm (Keita Urashima)

  • Login: ursm
  • Email: ursm@ursm.jp
  • Registered on: 01/13/2009
  • Last sign in: 09/15/2025

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 0 3 3

Activity

09/17/2025

12:25 AM Ruby Bug #21608 (Rejected): 三項演算子と break を組み合わせると SyntaxError
```
>> RUBY_VERSION
=> "3.4.5"
> ...
```
```
>> RUBY_VERSION
=> "3.4.6"
> ...
<internal:kernel>:168:in 'Kernel#loop': (irb):2: syntax error found (SyntaxError)
> 2 | ... i : nil }
| ^ unexpected local variable or metho...
ursm (Keita Urashima)

10/08/2024

11:30 PM Ruby Feature #20738: Removing a specific entry from a hash literal
OK, I'm sorry to hear that, but I'm glad to hear your opinions. Thanks. ursm (Keita Urashima)

09/16/2024

01:35 AM Ruby Feature #20738: Removing a specific entry from a hash literal
It would be better to explain the motive. This is an appropriate code.
``` ruby
{
foo: 1
bar: 2
}
```
This is not a mistake, but it's a circuitous code.
``` ruby
h = {}
h[:foo] = 1
h[:bar] = 2
h
```
The gist of ...
ursm (Keita Urashima)
01:19 AM Ruby Feature #20738: Removing a specific entry from a hash literal
I would like to offer that as I used a simple grep pattern, I could only find simple examples. I wanted to show that this is not as rare as it seems. ursm (Keita Urashima)

09/15/2024

12:36 PM Ruby Feature #20738: Removing a specific entry from a hash literal
Eregon (Benoit Daloze) wrote in #note-8:
> I don't think it's very frequent to need this to warrant a syntax change either.
There are several Rails codes that can be improved with this feature. In my opinion, it is especially useful ...
ursm (Keita Urashima)

09/14/2024

05:24 AM Ruby Feature #20738: Removing a specific entry from a hash literal
I believe that the following two points will prevent the same problems as in the past:
1. Use a value that is never used (e.g., Hash::DROP) instead of nil.
2. Special treatment of “special value” only if the hash is constructed with ...
ursm (Keita Urashima)

09/13/2024

02:58 PM Ruby Feature #20738: Removing a specific entry from a hash literal
With the previous idea, I can't have both removing entries and returning nil depending on the condition.
``` ruby
# If user.child? is true and user.parent is nil, I want parent_name: nil, but the entry is removed.
{
?parent_name:...
ursm (Keita Urashima)
01:17 PM Ruby Feature #20738: Removing a specific entry from a hash literal
nobu (Nobuyoshi Nakada) wrote in #note-1:
> "A special value" doesn't feel like a good idea to me.
Hmmm, does that mean we should extend the syntax? For example, something like this?
``` ruby
{
foo: 1,
?bar: nil
} #=> {foo...
ursm (Keita Urashima)
12:16 PM Ruby Feature #20738: Removing a specific entry from a hash literal
Yes, I sometimes do that as well. However, I am not happy that the shape of the resulting hash is unclear. ursm (Keita Urashima)
07:33 AM Ruby Feature #20738 (Rejected): Removing a specific entry from a hash literal
Sometimes I want to decide whether or not to add a particular entry to a hash depending on a condition. If the entire hash does not use nil, I can use Hash#compact.
```ruby
{
foo: 1,
bar: bar? ? 2 : nil
}.compact
```
But i...
ursm (Keita Urashima)

Also available in: Atom