Skip to content

Macros should have an operator type #426

Open
@rust-highfive

Description

@rust-highfive

Issue by darkf
Thursday Aug 29, 2013 at 11:55 GMT

For earlier discussion, see rust-lang/rust#8853

This issue was labelled with: A-syntaxext, I-enhancement in the Rust repository


AFAIK there is currently no way to quote an operator such as + or /, and this would be useful to reduce code duplication.

Something like:

macro_rules! foo(
    ($oper:op) => 10i $oper 20i
)

fn main() {
    printfln!("%d", foo!(+));
    printfln!("%d", foo!(*));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-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