How to convert any method to infix operator in ruby

后端 未结 4 1320
陌清茗
陌清茗 2020-12-20 03:40

In some language such as Haskell, it is possible to use any function taking two arguments as an infix operator.

I find this notation interesting and would like to ac

4条回答
  •  忘掉有多难
    2020-12-20 04:27

    Ruby does not have infix method syntax, except for a fixed and predefined set of operators. And Ruby does not allow user code to change the language syntax. Ergo, what you want is not possible.

提交回复
热议问题