Hacker News new | ask | show | jobs
by saurik 1097 days ago
Sure, but I am saying it would actually have made more sense to put receiver as the last such argument--as one might expect from having used Haskell/Erlang--given the other design decisions clearly in play here, as the target reference isn't really the first argument for any obvious reason other than visual effect and some historical baggage from implementations of some object-oriented languages (including Java) with different constraints.
1 comments

You're not wrong, but making self be the last argument would cause confusion for almost everyone coming from other languages, and for Rust it is too late to change that now. You could special case the behavior of the method call syntax to operate that way without breaking backwards compatibility (at the cost of making going back and forth between that syntax and the fully qualified call no longer being a straight forward syntactical transformation).
It would still break backward compatibility. As a trivial example,

    {println!("first"); 1u32}.wrapping_add({println!("second"); 1});
currently prints "first" before "second", but would switch.

But this could theoretically be done at an edition boundary.