Would Ownership be Easier for Beginners with a Small Change to Syntax?

I imagine a lot of confusion could be avoided by simply eliminating method call syntax entirely.

  • No more guessing at how the receiver is passed - use T::method(arg), T::method(&mut arg) or T::method(&arg) instead of arg.method()
  • No more "where does this method come from?" -- it's always obvious whether a method is from a type or a trait
  • No more accidentally calling .into_iter() on a reference and getting the wrong kind of iterator
  • It might cut down on the number of people who try to do "duck typing" like in Python or C++ templates if there literally isn't syntax for it
  • Keep . around only for field access syntax. No more need for the funny parens in (obj.function)()

There may be other advantages, I'll add more as I think of them...

Of course this is not a serious suggestion for Rust, but it's also not entirely meant in jest; I'd like to know how it works in practice. What languages have static typing, traits (or something trait-like), and no method call syntax? (Haskell?)

2 Likes