Forum: Ruby-core [ruby-trunk - Bug #7662][Open] Unable to define a method with bare `**`

428167a3ec72235ba971162924492609?d=identicon&s=25 Yehuda Katz (wycats)
on 2013-01-06 23:06
(Received via mailing list)
Issue #7662 has been reported by wycats (Yehuda Katz).

----------------------------------------
Bug #7662: Unable to define a method with bare `**`
https://bugs.ruby-lang.org/issues/7662

Author: wycats (Yehuda Katz)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 2.0.0dev


This works:

  def foo(*)
  end

This does not:

  def foo(**)
  end

This does not:

  def foo(*, **)
  end

I use bare `*` often in combination with bare `super` to extend a
superclass without being brittle to its exact signature. With keyword
arguments, this seems like it will be impossible. I am opening several
other related issues.
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 matz (Yukihiro Matsumoto) (Guest)
on 2013-01-07 02:46
(Received via mailing list)
Issue #7662 has been updated by matz (Yukihiro Matsumoto).

Assignee set to nobu (Nobuyoshi Nakada)
Target version set to next minor

I consider this as a bug.  Since it's minor issue, I defer fix to next
minor.

Matz.

----------------------------------------
Bug #7662: Unable to define a method with bare `**`
https://bugs.ruby-lang.org/issues/7662#change-35240

Author: wycats (Yehuda Katz)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: next minor
ruby -v: 2.0.0dev


This works:

  def foo(*)
  end

This does not:

  def foo(**)
  end

This does not:

  def foo(*, **)
  end

I use bare `*` often in combination with bare `super` to extend a
superclass without being brittle to its exact signature. With keyword
arguments, this seems like it will be impossible. I am opening several
other related issues.
F1d6cc2b735bfd82c8773172da2aeab9?d=identicon&s=25 Nobuyoshi Nakada (nobu)
on 2013-01-07 04:20
(Received via mailing list)
Issue #7662 has been updated by nobu (Nobuyoshi Nakada).


You don't need ** here.
A rest argument includes keyword hash if the method does not have
keyrest argument.
----------------------------------------
Bug #7662: Unable to define a method with bare `**`
https://bugs.ruby-lang.org/issues/7662#change-35245

Author: wycats (Yehuda Katz)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: next minor
ruby -v: 2.0.0dev


This works:

  def foo(*)
  end

This does not:

  def foo(**)
  end

This does not:

  def foo(*, **)
  end

I use bare `*` often in combination with bare `super` to extend a
superclass without being brittle to its exact signature. With keyword
arguments, this seems like it will be impossible. I am opening several
other related issues.
Bcb6acc9d0d9bef99e033b36c3d32ca9?d=identicon&s=25 charliesome (Charlie Somerville) (Guest)
on 2013-01-07 04:23
(Received via mailing list)
Issue #7662 has been updated by charliesome (Charlie Somerville).


=begin
I think this is important for consistency. Consider:

  def f(a, b, **opts)
    # ...
    super
  end
=end
----------------------------------------
Bug #7662: Unable to define a method with bare `**`
https://bugs.ruby-lang.org/issues/7662#change-35246

Author: wycats (Yehuda Katz)
Status: Open
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: next minor
ruby -v: 2.0.0dev


This works:

  def foo(*)
  end

This does not:

  def foo(**)
  end

This does not:

  def foo(*, **)
  end

I use bare `*` often in combination with bare `super` to extend a
superclass without being brittle to its exact signature. With keyword
arguments, this seems like it will be impossible. I am opening several
other related issues.
F24ff61beb80aa5f13371aa22a35619c?d=identicon&s=25 mame (Yusuke Endoh) (Guest)
on 2013-01-07 04:26
(Received via mailing list)
Issue #7662 has been updated by mame (Yusuke Endoh).

Status changed from Open to Assigned

Thanks for your feedback.  I'm neutral for bare `**` itself.
But it is too late a bit to discuss the spec and there is an obvious
workaround:

  def foo(**dummy)
  end

Of course, we can add bare `**' later (say, in 2.0.1).


BTW:

> I use bare `*` often in combination with bare `super` to extend a superclass
without being brittle to its exact signature.

I don't think that it is a good idea to ignore arguments silently just
for a bare `super`.
You should call super with explicit argument delegation if your
overriding method changes the signature of its parent method.
----------------------------------------
Bug #7662: Unable to define a method with bare `**`
https://bugs.ruby-lang.org/issues/7662#change-35247

Author: wycats (Yehuda Katz)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category:
Target version: next minor
ruby -v: 2.0.0dev


This works:

  def foo(*)
  end

This does not:

  def foo(**)
  end

This does not:

  def foo(*, **)
  end

I use bare `*` often in combination with bare `super` to extend a
superclass without being brittle to its exact signature. With keyword
arguments, this seems like it will be impossible. I am opening several
other related issues.
This topic is locked and can not be replied to.