rust-lang / rust-lang/rfcs

UFCS RFC needs to be clearer about method call syntax

Open
#395 7 comments 0 reactions 1 assignee View on GitHub

@pnkfelix is already working on this.

Since Oct 17, 2018.

A-resolve A-syntax T-lang
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

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 type S that implements ToStr and also has its own impl 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() }, or
  • fn f(s: &S) -> String { ToStr::to_str(s) }, or
  • both?

and likewise:

  • fn g(s: &S) -> String { s.<S>::to_str(10) }, or
  • fn g(s: &S) -> String { <S>::to_str(s, 10) }, or
  • both?

(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.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.