[#82706] [Ruby trunk Bug#13851] getting "can't modify string; temporarily locked" on non-frozen instances — cardoso_tiago@...
Issue #13851 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/07
[#82853] [Ruby trunk Bug#13916] Race condition when sending a signal to a new fork — russell.davis@...
Issue #13916 has been reported by russelldavis (Russell Davis).
3 messages
2017/09/19
[#82892] [Ruby trunk Bug#13921] buffered read_nonblock doesn't work as expected using SSLSocket — cardoso_tiago@...
Issue #13921 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/20
[ruby-core:82844] [Ruby trunk Bug#13913] Method definition with explicitly callable method names
From:
tagomoris@...
Date:
2017-09-17 15:28:44 UTC
List:
ruby-core #82844
Issue #13913 has been updated by tagomoris (Satoshi TAGOMORI).
I cannot understand "But you may want to discuss the issue further." correctly... But,
Biggest thing of my idea is "there's no need to name the interface (a set of methods)".
In Ruby ecosystem, there are many cases that an argument is expected to respond to just one method:
* `call` for Rack middleware object
* `each` for Rack body object (3rd member of Rack handler return value)
IMO most important thing is there's no need to name them. The only required is just a set of methods.
I think this feature is not easy to implement in Ruby, but I'm happy if it's an option for typing of Ruby3.
----------------------------------------
Bug #13913: Method definition with explicitly callable method names
https://bugs.ruby-lang.org/issues/13913#change-66735
* Author: tagomoris (Satoshi TAGOMORI)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
There are many cases to expect that arguments should respond to a/some methods like this:
```ruby
def call_foo(arg)
if !(arg.respond_to(:to_s) and arg.respond_to(:to_a) and arg.respond_to(:readpartial))
raise ArgumentError, "interface mismatch"
end
end
```
This is very frequent pattern, and I'm very happy to write this code in very short lines like this:
```ruby
def call_foo(arg|to_s,to_a,readpartial)
# ...
end
```
This feature looks very useful and have space to analyze statically and to optimize dynamically.
And, there may be possibility to allow to have method overriding.
What do you think about this idea?
--
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>