ruby-dev (Japanese) list archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "shugo (Shugo Maeda)" <noreply@ruby-lang.org>
To: ruby-dev@ml.ruby-lang.org
Subject: [ruby-dev:52012]  [Ruby master Feature#19134] ** is not allowed in def foo(...)
Date: Sun, 04 Dec 2022 23:46:45 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-100495.20221204234644.12@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-19134.20221117092700.12@ruby-lang.org>

Issue #19134 has been updated by shugo (Shugo Maeda).

Status changed from Closed to Open

I think it's most conservative to probhibit `*` and `**`:

```
def foo(...)
  bar(&) # OK
  baz(*) # error
  quux(**) # error
end
```

And a error should occur in the following code instead of dropping keyword arguments:

```
def foo(*, **, &)
  bar(...)
end

def bar(*args, **kw, &block)
  p [args, kw, block&.call]
end

foo(1, 2, x: 3, y: 4) { 5 }
```

What do you think, Matz?


----------------------------------------
Feature #19134: ** is not allowed in def foo(...)
https://bugs.ruby-lang.org/issues/19134#change-100495

* Author: shugo (Shugo Maeda)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
`*` and `&` are allowed in the body of a method with `...` argument forwarding, but `**` is not allowed.

```
def foo(...)
  bar(*) # OK
  baz(&) # OK
  quux(**) # NG
end
```

Is it intended behavior?

It seems that parse.y has code like `#ifdef RUBY3_KEYWORDS`, and if RUBY3_KEYWORDS, `**` will also be supported.




-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2022-12-04 23:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17  9:27 [ruby-dev:51203] " shugo (Shugo Maeda)
2022-11-28  8:16 ` [ruby-dev:52003] " shugo (Shugo Maeda)
2022-11-28 22:39 ` [ruby-dev:52004] " matz (Yukihiro Matsumoto)
2022-11-29  2:57 ` [ruby-dev:52006] " shugo (Shugo Maeda)
2022-12-04 18:04 ` [ruby-dev:52009] " Eregon (Benoit Daloze)
2022-12-04 18:08 ` [ruby-dev:52010] " Eregon (Benoit Daloze)
2022-12-04 22:48 ` [ruby-dev:52011] " shugo (Shugo Maeda)
2022-12-04 23:46 ` shugo (Shugo Maeda) [this message]
2022-12-12 14:04 ` [ruby-dev:52021] " Eregon (Benoit Daloze)
2022-12-14  7:12 ` [ruby-dev:52025] " mame (Yusuke Endoh)
2022-12-15 12:26 ` [ruby-dev:52027] " shugo (Shugo Maeda)
2022-12-15 13:47 ` [ruby-dev:52028] " Eregon (Benoit Daloze)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-100495.20221204234644.12@ruby-lang.org \
    --to=noreply@ruby-lang.org \
    --cc=ruby-dev@ml.ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).