Le mercredi 07 octobre 2015 à 08:31 -0700, cheng wang a écrit : > Just looks natural in some cases. > > For example: Man.eat(food) looks better than eat(Man, food). > > A similar situation is arithmetic expression. 2 + 3 might look more > natural than (+ 2 3). Looks like you'd rather want to write Man `eat` food or something similar instead of Man.eat(food).
For previous discussions about this, search for "infix operator" in the list archives and on GitHub. Regards > On Wednesday, October 7, 2015 at 5:23:23 PM UTC+2, Simon Danisch > wrote: > > There are a lot of things "one could do" ;) Can you give some > > appealing reasons, why someone should invest his/her time into > > this? > > > > Best, > > Simon > > > > > > Am Mittwoch, 7. Oktober 2015 17:13:33 UTC+2 schrieb cheng wang: > > > Hello everyone, > > > > > > In some cases, I would like to make a function belongs to an > > > object. > > > In classical OO, we do something like object.f(args...). > > > In Julia, we could do it like this: f(object, args...). > > > > > > So I was wandering if there is some way to do following: > > > I write object.f(args...), while julia could know it actual means > > > f(object, args...). > > > > > > One naive way to implement this is in two steps: > > > first, the compiler search for a field of object equal to f, if > > > it's not found, > > > then, compiler search for a function like f, and the invoke it. > > > > > > Looking forward for your opinions! > > >