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.

+ Instead of to have an attribute for the documentation, the parser
could get the comment on top of the function to get its documentation.

This already works, if you use /** */ or /// to begin the comments. (I think /// has a bug though in that it only takes the first such comment; that's a bug and should be fixed.)

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

Reply via email to