-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UFCS RFC needs to be clearer about method call syntax #395
Comments
At least the second option for both. I think the first form should also be allowed since at worse it will be redundant and in some cases could restrict the traits examined in trait matching, whilst still doing dynamic dispatch. |
cc me |
Another argument for supporting |
The UFCS RFC did not propose any way to use method-call syntax in this fashion. This would be a distinct RFC, I believe. |
Is this still valid? |
I’ll review |
RFC PR #132 (UFCS) had many descriptions of various paths, but completely omitted concrete examples of an actual method call (with the receiver expression and the arguments) written via the proposed notation.
In particular, assuming a
trait ToStr { fn to_str(&self) -> String }
and typeS
that implementsToStr
and also has its ownimpl S { fn to_str(&self, max: uint) -> String }
are we expecting to be able to write:fn f(s: &S) -> String { s.ToStr::to_str() }
, orfn f(s: &S) -> String { ToStr::to_str(s) }
, orand likewise:
fn g(s: &S) -> String { s.<S>::to_str(10) }
, orfn g(s: &S) -> String { <S>::to_str(s, 10) }
, or(Perhaps the answer is implied by some other document that specifies whether method call expressions use a full path for the method name, or just an identifier and optional generics args list
::<T, U, ...>
. Nonetheless this detail is important enough to go into the document itself.)The text was updated successfully, but these errors were encountered: