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

Posted by 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.
Posted by 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.
Posted by 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.
Posted by 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.
Posted by 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.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.