On Tuesday, 13 May 2014 at 21:16:55 UTC, Timon Gehr wrote:
On 05/13/2014 09:07 PM, Jacob Carlborg wrote:
On 2014-05-13 15:56, Dicebot wrote:

Judging by http://static.rust-lang.org/doc/0.6/tutorial-macros.html those are not full-blown AST macros like ones you have been proposing,
more like hygienic version of C macros.

Hmm, I haven't looked at Rust macros that much.


Again, the following is an example of Rust macros in action. A bf program is compiled to Rust code at compile time.

https://github.com/huonw/brainfuck_macro/blob/master/lib.rs

Compile-time computations create an AST which is then spliced. Seems full-blown enough to me and not at all like C macros.

I really don't know, but understanding is that there are two types of macros in Rust. There's the simple "hygienic macro" one, which has some documentation: http://static.rust-lang.org/doc/0.10/guide-macros.html. Then there's the other, newer kind of macros (they may be called "procedural macros"... or not) and those are basically undocumented at this point. My understanding is that the newer kind of macros can do literally anything, like order you a pizza at compile-time.

Reply via email to