On 19/10/12 07:49, Patrick Walton wrote:
On 10/18/12 11:43 PM, John Mija wrote:
Rust has attributes[1] at function-level but (1) the compilation could
be faster if they were at file-level

I don't think it'd be significantly faster. cfg'd off items are
eliminated very early in compilation (right after parsing).

(2) the project would be more homogeneous and clean.

At the cost of annoyance when you just have a few functions that differ
per-platform. For example, there's just one Apple-specific function in
our Apple gl2.rs bindings right now. Having to create a gl2_mac.rs file
would be inconvenient.

+ Instead of to have the attribute "#[test]" for a function, those tests
functions could be into a file with the name finished in "_test"
(foo_test.rs) indicating that there are unit tests. On this case, we
would not need an attribute.

If there are few unit tests, this could get annoying.

It would make sense to have an attribute at file-level in cases where you have a lot of tests or code for a specific system/architecture, or just because you want to have all more organized.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to