[#91458] [Ruby trunk Feature#4475] default variable name for parameter — matz@...
Issue #4475 has been updated by matz (Yukihiro Matsumoto).
3 messages
2019/02/07
[ruby-core:91567] [Ruby trunk Feature#15574] Prohibit to pass a block on super() implicitly
From:
mail@...
Date:
2019-02-15 11:46:08 UTC
List:
ruby-core #91567
Issue #15574 has been updated by sos4nt (Stefan Schテシテ殕er).
sawa (Tsuyoshi Sawada) wrote:
> [...] it is inconsistent that you want to take care of the arguments but not the block.
When overriding a method, I try to preserve its signature. Therefore, I usually use `super` and I sometimes use `super(...)` with *optional* arguments as shown above. But having to unset a block via `super(&nil)` happens once in a blue moon.
My point is: it might be inconsistent, but it is a good inconsistency. It does what you almost always want.
And since `super` is a *keyword*, I think it can get away with it.
----------------------------------------
Feature #15574: Prohibit to pass a block on super() implicitly
https://bugs.ruby-lang.org/issues/15574#change-76830
* 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/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>