Skip to content

UFCS RFC needs to be clearer about method call syntax #395

Open
@pnkfelix

Description

@pnkfelix

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

Metadata

Metadata

Assignees

Labels

A-resolveProposals relating to name resolution.A-syntaxSyntax related proposals & ideasT-langRelevant to the language team, which will review and decide on the RFC.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions