Project

General

Profile

Actions

Feature #12129

open

syntactic sugar for dynamic method dispatch `object_expression:method_name_expression(1, 2)`

Added by bughit (bug hit) over 8 years ago. Updated over 8 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:74067]

Updated by matz (Yukihiro Matsumoto) over 8 years ago

Describe more concretely and preferably tell us why do you need it, please.

Matz.

Updated by bughit (bug hit) over 8 years ago

Yukihiro Matsumoto wrote:

Describe more concretely and preferably tell us why do you need it, please.

object_expression:method_name_expression(1, 2)

would be sugar for

object_expression.__send__(method_name_expression, arg1, arg2)

like any sugar, you can live without it, but I think a dynamic language should have it.

e.g. in javascript: object_expression[method_name_expression](arg1, arg2)

Updated by jwmittag (Jörg W Mittag) over 8 years ago

bug hit wrote:

Yukihiro Matsumoto wrote:

Describe more concretely and preferably tell us why do you need it, please.
object_expression:method_name_expression(1, 2)

would be sugar for

object_expression.__send__(method_name_expression, arg1, arg2)

Please, for the love of all that is holy, regardless of whatever syntax sugar you choose, make it translate or equivalent to public_send, not __send__!

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0