[#78633] ruby/spec needs help from CRuby committers — Benoit Daloze <eregontp@...>
Currently, ruby/spec is maintained mostly by individuals and enjoys the
13 messages
2016/12/13
[#78963] Re: ruby/spec needs help from CRuby committers
— Urabe Shyouhei <shyouhei@...>
2017/01/04
I did ask attendees of last developer meeting to join this
[#78642] Re: ruby/spec needs help from CRuby committers
— Eric Wong <normalperson@...>
2016/12/14
Benoit Daloze <eregontp@gmail.com> wrote:
[ruby-core:78779] [Ruby trunk Feature#12861] super in a block can be either lexically or dynamically scoped depending on how the block is invoked
From:
shyouhei@...
Date:
2016-12-21 14:22:31 UTC
List:
ruby-core #78779
Issue #12861 has been updated by Shyouhei Urabe.
We looked at this issue at today's developer meeting.
I think attendees had an assumption that changing behavour of `super` is too drastic. This feature (if added) should be called something new. So there are rooms for dynamic_super. For lexical one, I like the idea. But Matz was wondering if such lexically-scoped super would actually get used.
----------------------------------------
Feature #12861: super in a block can be either lexically or dynamically scoped depending on how the block is invoked
https://bugs.ruby-lang.org/issues/12861#change-62181
* Author: bug hit
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Target version:
----------------------------------------
```ruby
class Class1
def self.foo
'foo'
end
def self.method1
'method1'
end
end
class Class2 < Class1
def self.foo
bar do
super()
end
end
def self.bar(&block)
a = block.()
define_singleton_method :method1, &block
b = send(:method1)
c = block.()
[a, b, c]
end
end
p Class2.foo # ["foo", "method1", "foo"]
```
It doesn't seem like a good idea for a given language construct to be either lexically or dynamically scoped, depending on how its surrounding block is invoked (which is not visible at the point of definition). I think it would be better if super were always lexically scoped, and a different keyword (dynamic_super) were always dynamically scoped
--
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>