Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Order of execution - building a dependency tree of macros #2

Open
m1212e opened this issue Oct 1, 2024 · 1 comment
Open

Order of execution - building a dependency tree of macros #2

m1212e opened this issue Oct 1, 2024 · 1 comment

Comments

@m1212e
Copy link

m1212e commented Oct 1, 2024

Hi,

thanks for this crate, it really helps optimizing macro performance and even allows for things which were not possible without shared state between macro calls!

While building my macros a question occurred: Is there a way to build some form of macro dependency order? E.g. I have a proc derive macro that reads and saves the field names of a struct into my state. Later I want to use a macro to build a query fot a database call and I need to know the field names. The second macro depends on the first one. Is there some way to make the compiler wait for the data to be available? E.g. by some polling mechanism? Do you happen to know if the compiler is running in parallel so I can block the execution of one macro to wait for the other to finish? Thanks!

@sam0x17
Copy link
Owner

sam0x17 commented Oct 2, 2024

So I would say this crate is highly deprecated and relies on some undefined behavior in the compiler so is quite likely to break in random circumstances. A much better, safer pattern is usually to do something like the outer macro pattern + my macro_magic crate

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants