ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: duerst@it.aoyama.ac.jp
To: ruby-core@ruby-lang.org
Subject: [ruby-core:91403] [Ruby trunk Feature#15574] Prohibit to pass a block on super() implicitly
Date: Tue, 05 Feb 2019 03:27:30 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-76659.20190205032728.c1ad62d05abde209@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15574.20190130071217@ruby-lang.org

Issue #15574 has been updated by duerst (Martin Dürst).


ko1 (Koichi Sasada) wrote:

> Why don't you pass a block parameter explicitly?
> Because you know the spec and intentional, or simply forget to pass it (and working it with this spec fortunately)?

Until quite recently, using an explicit block parameter was (considered to be?) less efficient than an implicit block parameter.

----------------------------------------
Feature #15574: Prohibit to pass a block on super() implicitly
https://bugs.ruby-lang.org/issues/15574#change-76659

* Author: ko1 (Koichi Sasada)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
As described in [Feature #15554], `super()` (not `super`) pass the given block.

```
class C
  def foo
    p block_given?
  end
end

class C1 < C
  def foo
    super   #=> true
    super() #=> true
  end
end

C1.new.foo{}
```

`super` (without parameters) passes all passed parameters so it is no surprise to pass given block. 

However, `super()` (with parameters. In this case, it passes 0 parameters) also pass given block implicitly.

I'm not sure who use this behavior, but I think it is simple to prohibit such implicit block passing.




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

  parent reply	other threads:[~2019-02-05  3:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-15574.20190130071217@ruby-lang.org>
2019-01-30  7:12 ` [ruby-core:91332] [Ruby trunk Feature#15574] Prohibit to pass a block on super() implicitly ko1
2019-01-30 10:12 ` [ruby-core:91335] " Webhostingonedollar102
2019-01-30 10:17 ` [ruby-core:91336] " Webhostingonedollar102
2019-01-30 12:12 ` [ruby-core:91338] " eregontp
2019-02-04 18:25 ` [ruby-core:91394] " ruby-core
2019-02-05  2:02 ` [ruby-core:91402] " ko1
2019-02-05  3:27 ` duerst [this message]
2019-02-05  4:42 ` [ruby-core:91404] " sawadatsuyoshi
2019-02-15 10:20 ` [ruby-core:91558] " mail
2019-02-15 10:48 ` [ruby-core:91562] " sawadatsuyoshi
2019-02-15 11:02 ` [ruby-core:91563] " mail
2019-02-15 11:10 ` [ruby-core:91564] " sawadatsuyoshi
2019-02-15 11:42 ` [ruby-core:91566] " eregontp
2019-02-15 11:46 ` [ruby-core:91567] " mail
2019-10-21  8:14 ` [ruby-core:95451] [Ruby master " ko1

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-list from there: mbox

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

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

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

  git send-email \
    --in-reply-to=redmine.journal-76659.20190205032728.c1ad62d05abde209@ruby-lang.org \
    --to=ruby-core@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 read-only IMAP folder(s) and NNTP newsgroup(s).