Project

General

Profile

Feature #12129

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

Added by bughit (bug hit) about 1 year ago. Updated about 1 year ago.

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

History

#1 [ruby-core:74076] Updated by matz (Yukihiro Matsumoto) about 1 year ago

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

Matz.

#2 [ruby-core:74077] Updated by bughit (bug hit) about 1 year 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)

#3 [ruby-core:74292] Updated by jwmittag (Jörg W Mittag) about 1 year 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__!

Also available in: Atom PDF