On Thursday, 11 June 2015 at 15:03:39 UTC, Dicebot wrote:
Those are considerably less powerful:
- can only have type arguments
- no variadic argument list support
- no arbitrary condition constraints (thus only partial duck typing support)

On the other hand they have one important advantage: all type arguments must comply to one or more trairs and thus bodies of generics are checked before institation. You are only allowed to call methods and operations of generic arguments that are defined in relevan trait. This is huge win for code hygiene compared to D.

Any sort of more advanced meta-programming things can only be done via AST macros which is currently the biggest downside in my eyes when it comes to features. Though quite some people like that.

The fact that there is no support variadiс arguments, it is really negative.

It is possible that Walter and Andrei against macro because of this:

macro_rules! o_O {
    (
        $(
            $x:expr; [ $( $y:expr ),* ]
        );*
    ) => {
        &[ $($( $x + $y ),*),* ]
    }
}

fn main() {
    let a: &[i32]
        = o_O!(10; [1, 2, 3];
               20; [4, 5, 6]);

    assert_eq!(a, [11, 12, 13, 24, 25, 26]);
}

It looks disgusting! ;)

Reply via email to