General

Profile

ozydingo (Andrew Schwartz)

  • Login: ozydingo
  • Registered on: 01/07/2016
  • Last sign in: 02/01/2025

Issues

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

Activity

02/01/2025

06:37 AM Ruby Feature #19555: Allow passing default options to `Data.define`
I've found the need for something like this as well, I have a use case where it's getting repetitive and distractingly verbose to build out the `Data` blocks just for a number of defaults. The mutable defaults is a really good point, tho... ozydingo (Andrew Schwartz)

04/21/2024

02:33 PM Ruby Misc #20441: Should passing keyword args to method_name(*) be an error?
Understanding better the role of `ruby2_keywords` is helping, thank you. It seemed to me that either way some compatibility was broken, but the subtleties of maintaining compatibility as well as possible in a variety of circumstances is ... ozydingo (Andrew Schwartz)
08:47 AM Ruby Misc #20441: Should passing keyword args to method_name(*) be an error?
Why does this conversion to a Hash occur?
I would guess for some sense of backward compatibility with gems / code written in earlier versions of Ruby. But #20440 demonstrates why this compatibility is not achieved. To be clear, I'm no...
ozydingo (Andrew Schwartz)
08:25 AM Ruby Misc #20441 (Closed): Should passing keyword args to method_name(*) be an error?
In the following method:
```rb
def foo(*)
super
end
```
it is apparently the intended ruby 3 behavior to pass keyword args as a positional Hash to `super`. I believe this is confusing and can lead to hidden and hard-to-discov...
ozydingo (Andrew Schwartz)
08:15 AM Ruby Bug #20440: `super` from child class duplicating a keyword argument as a positional Hash
Ok I see it now; `super` isn't passing the args as both forms, it's passing _only_ as a positional Hash. The `x: 1` is coming from my default kwarg, which I was blinded to as I attempted to reduce the example to a general form. Thanks all! ozydingo (Andrew Schwartz)
07:02 AM Ruby Bug #20440: `super` from child class duplicating a keyword argument as a positional Hash
Thanks both. I understand that Ruby 3 requires explicit handling of keyword arguments. What still seems off to me is that `super` is _modifying_ the arguments. The child method is being passed a keyword argument, and `super` is forwardin... ozydingo (Andrew Schwartz)

04/20/2024

09:12 AM Ruby Bug #20440: `super` from child class duplicating a keyword argument as a positional Hash
In fact it seems we can simplify this to just calling `Child.new.foo(x: 1)`; no need for the base class `foo!` method.
```rb
Child.new.foo(x: 1)
Child: calling foo
Base: calling foo with args: [{:x=>1}], x: 1
```
Apologies if I'm misu...
ozydingo (Andrew Schwartz)
09:00 AM Ruby Bug #20440 (Closed): `super` from child class duplicating a keyword argument as a positional Hash
Apologies for the verbose title, but that's the specific set of conditions that AFAICT are required to reproduce the bug!
Here's the simplest setup I can reproduce:
```rb
class Base
def foo(*args, x: 1)
puts "Base: calling...
ozydingo (Andrew Schwartz)

01/12/2024

02:34 PM Ruby Bug #20180 (Closed): Inconsistent evaluation of `**{}` depending on position in array
Reproduced on ruby:3.3 docker container
The evaluation of `**{}` differs if it appears alone (evaluates as empty / no content) in an array vs after another element (evaluates as an empty Hash).
```rb
args = []; kwargs = {}
[*args...
ozydingo (Andrew Schwartz)

03/08/2016

02:26 AM Ruby Bug #10708: In a function call, double splat of an empty hash still calls the function with an argument
Adding to this, the current behavior results in the following inconsistent behavior: I can call an argless method using a double-splatted empty Hash directly, but this cannot be done via a delegating or overriding method. I'm encounterin... ozydingo (Andrew Schwartz)

Also available in: Atom