I have an off-the-wall proposal I discussed briefly with dherman: "scoped numeric literal type directives".

The easiest way to explain this is by example; this:

    use u32;
    log(tup(1, 2, 3));

would be equivalent to:

    log(tup(1u32, 2u32, 3u32));

The "use" directive would be scoped to the block it appears in. It would change the type of all integer literals without an explicit type suffix to the specified type.

The motivation for this is the repeated type declarations in benchmarks like fasta [1]. They can make code somewhat noisy.

Thoughts? Apologies in advance for treading perilously close to syntax bikeshedding!

Patrick

[1]: http://github.com/graydon/rust/blob/master/src/test/bench/shootout/fasta.rs

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

Reply via email to