Feature #12129
opensyntactic sugar for dynamic method dispatch `object_expression:method_name_expression(1, 2)`
Updated by matz (Yukihiro Matsumoto) almost 10 years ago
Describe more concretely and preferably tell us why do you need it, please.
Matz.
Updated by bughit (bug hit) almost 10 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) almost 10 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__!