4 ms·
Deos anyone have an example beyond the one on that page? I'm having a hard time understanding. So, I'm interested in some metaprogramming right now. I'm settin
by the__alchemist 2y ago
Deos anyone have an example beyond the one on that page? I'm having a hard time understanding.
So, I'm interested in some metaprogramming right now. I'm setting up Vec3 SIMD types, and it requires a lot of repetition to manage the various variants: f32::Vec3x8, f64::Vec3x16 etc that are all similar internally. This could be handled using traditional macros, procedural macros, or something called "code gen", which I think is string manipulation of code. Could I use crabtime to do this instead? Should I?
- CGamesPlay 2y agoHonestly, this long document is probably a better link than the crates.io page: https://docs.rs/crabtime/latest/crabtime/ https://docs.rs/crabtime/latest/crabtime/ > This could be handled using traditional macros, procedural macros, or something called "code gen", which I think is string manipulation of code. Could I use crabtime to do this instead? Should I? You could, it seems. Crabtime supports both the procedural macros and "code gen" approaches you are talking about.
- codedokode 2y agoFor simply copy-pasting code you could start with using simplest traditional macros. No matter what approach you choose your code will be pain to read and understand (maybe we need to have "show generated code" button in our IDEs).
- conaclos 2y agoActually we have a command to do exactly what you want: `expand macro`. Crabtime claims to have the same thing.