Skip to content

Infix notation for function call / invocation. #1579

@Centril

Description

@Centril

There doesn't seem to be much support for supporting custom operators (see #818) in Rust. But what about calling normal binary functions as if they were operators, like haskell allows you to?

The syntax would be:

a `dot` b

to convey scalar product of two vectors a and b.

Another option suggested by @bluss:

a \dot b

Or if it possible without parsing conflicts (@thepowersgang: "but probably not dersirable"):

a dot b

Which is converted to

a.dot( b )

or, depending on the function:

dot( a, b )

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions