Re:Writing Complex Macros in Rust: Reverse Polish Notation
by foldr on Thursday February 01, 2018 @07:48AM
(#16281469)
Rust macros actually work more at the token level than at the AST level.
Re:Writing Complex Macros in Rust: Reverse Polish Notation
by RReverser on Thursday February 01, 2018 @08:00AM
(#16281531)
They work on both - for example, if you specify $expr:expr, it will actually parse it as an expression node and won't allow to simply pass it into another macro as $pat:pat because of AST node type mismatch even if actual tokens are still compatible.
Re:Writing Complex Macros in Rust: Reverse Polish Notation
by foldr on Thursday February 01, 2018 @08:34AM
(#16281713)
That's a good point. What I was trying to get at is that Rust macros don't let you manipulate ASTs in any straightforward way. So they are not best thought of as AST -> AST transforms.
So I don't really know lisp macros but I guess it's still closer than to C.