Project

General

Profile

Actions

Bug #13912

closed

Method definition with explicitly callable method names

Added by tagomoris (Satoshi Tagomori) over 6 years ago. Updated over 6 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
[ruby-core:82841]

Description

There are many cases to expect that arguments should respond to a/some methods like this:

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:

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?


Related issues 1 (1 open0 closed)

Is duplicate of Ruby master - Feature #13913: Method definition with explicitly callable method namesOpenActions
Actions #1

Updated by hsbt (Hiroshi SHIBATA) over 6 years ago

  • Is duplicate of Feature #13913: Method definition with explicitly callable method names added
Actions #2

Updated by hsbt (Hiroshi SHIBATA) over 6 years ago

  • Status changed from Open to Rejected
Actions

Also available in: Atom PDF

Like0
Like0Like0