tlborm
tlborm copied to clipboard
Code in Chapter 3 cannot compile
The compiler doesn't allow the ( a[n]: $sty:ty = $($inits:expr),+ ... $recur:expr )
pattern, as mentioned in https://danielkeep.github.io/tlborm/book/mbe-min-captures-and-expansion-redux.html, only =>
, ,
and ;
can follow a expr capture.
BTW, it seems that the MEMORY
s in this code block should be MEM_SIZE
.
Yep, in rust 1.28, the code doesn't work.
It's just a guide. Writing it in that way to make more understandable. We can remove the ...
and simply change it to:
// just separate them with ';' or '=>'
[$seq:ident [$ind:ident]: $sty:ty = $($inits:expr),+; $recur:expr]
[$seq:ident [$ind:ident]: $sty:ty = $($inits:expr),+ => $recur:expr]