David Herman wrote:
Is there really value in attributes being applied on the inside? That seems 
really odd to me.

I thought so too at first but now I find it much more readable in general.

Comments, for example, seem to look better inside the function than in front. Then I can see the function name and parameters immediately, which is usually what I want to know first:

fn foo(x: T, y: U) {
    /*!
     * ...
     */
}

I haven't tried writing other attributes inside much, but I could imagine a similar principle might apply.

For example:

    struct Foo {
        #[auto_encode];
        #[auto_decode];
        #[deriving_eq];

        field1: int, field 2: int
    }

vs

     #[auto_encode]
     #[auto_decode]
     #[deriving_eq]
    struct Foo {
       field1: int, field 2: int
    }

I always find the latter (which is what we do today) pretty hard to read, actually, but the former seems pretty easy.


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

Reply via email to