On 10-09-16 05:26 PM, Patrick Walton wrote:
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!
Perhaps so. Could similarly switch the default interpretation of a
floating-point literal (as f32, f128, or one of the decimals when
they're supported). Hm.
It's similar to another thing I've considered borrowing from C#, static
toggles for overflow checking on integer code generation within a block.
But .. the latter is somewhat specialized, easier to picture just
telling the user to call library or macro code. What you're talking
about seems a bit more common and aesthetic-oriented.
The argument against, of course, is that it undermines legibility by
requiring more state in the reader's mind. Literal lexemes are no longer
standalone. Hard to say for sure.
Willing to try it, I guess. In any case, I am not keen on overloading
the 'use' namespace this way. Syntactically, I think something more like
'pragma' would be better.
-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev