So far, I have had a difficult time finding anything definitive on this
except for some rust test code.

fn main() {
    // PART 1: works (from rust test code)
    let asdf_fdsa = ~"<.<";
    io::println(concat_idents!(asd, f_f, dsa));
    io::println(stringify!(use_mention_distinction));

    // PART 2: creating a function identifier
    fn concat_idents!(foo, _, bar) () { // fails to compile
        io::println("Foo!");
    }
    foo_bar();

    // PART 3: a numeric is a bad identifier, but a good sub-identifier
    let asdf3 = ~">.>";
    io::println(concat_idents!(asdf, 3)); // fails to compile
}

The first part works fine.

The second part, creating a function identifier seems a perfectly valid
use-case, but fails compilation, and I don't know a valid work-around.  I
have been unable to find a similar usage anywhere.

This third part was just some wishful thinking, actually, but if there are
ways to do this directly (other than changing "3" to a valid identifier
like "N3"), I would love to know.
(Though, this might not longer have much of a use case if/when generics
eventually support integral parameters.)

Ashish
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to