Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think your point is to emphasize there is no additional cost to method syntax. I wasn't trying to imply there was, only that when you want dynamic dispatch, you can only get it from method syntax.

Another interesting asymmetry, which I think shows a weird favoritism for method syntax is that Rust allows both of these:

   object_of_type_A.foo()
   object_of_type_B.foo()
But not both of these:

   foo(object_of_type_A)
   foo(object_of_type_B)
Ignoring dynamic/static dispatch for the moment, you can overload if you use method syntax, but not if you use function syntax. For me, I would prefer the latter, but I think I'm clearly in the minority.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: