5
macro_rules! a_macro {
($($a:tt)+) => ($($a)+);
}
fn main() {
let x:u32 = 1;
let y:u32 = a_macro!(-x);
}
失敗,
<anon>:2:23: 2:25 error: unexpected token: `an interpolated tt`
<anon>:2 ($($a:tt)+) => ($($a)+);
^~
playpen: application terminated with error code 101
這讓我傷心。我希望能夠用宏來製造組合器,並且無法返回令牌會造成痛苦。 :-( – user
@user:宏是目前正在進行的一項工作;已經非常有用,但遠未達到他們所能想象的那麼靈活 –
@MatthieuM。不抱怨自己的侷限性,訂單年表使用壯觀的未來鏽蝕:-D – user