-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port code generator from C# to Rust #50
Comments
Have you seen this project? Maybe some parts could be reused (and even if not, there are some links to useful info). |
Maybe we can make use of the metadata reader implemented as part of https://github.com/Microsoft/xlang (https://github.com/Microsoft/xlang/tree/master/src/library/impl/meta_reader), which is written in modern C++ and could probably be ported to Rust easier than something like |
Thanks for the link, that project seems really interesting. It's essentially an open source implementation of the Windows Runtime. Also, it seems to contain the cppwinrt compiler/code generator itself as described in the wiki. |
Yes, the project was announced only yesterday on the author's blog (same author as cppwinrt): https://kennykerr.ca/2018/10/10/xlang/ |
Wait, really? That's pretty fucking awesome! I'm excited. |
We probably can also hide much of the generated code behind procedural macros now that they are stable (though that arguably means that someone who wants to understand what actually happens in the generated code needs to drill through yet another layer of magic – but I guess that procedural macros can't get worse than the declarative macros we have now). |
I'm working on a Rust port of xlang's meta_reader (https://github.com/Microsoft/xlang/tree/master/src/library/impl/meta_reader), but have nothing to show yet. |
A first (incomplete) version of a CLI metadata reader in Rust is now available: https://github.com/Boddlnagg/climeta |
I'd suggest to nog go down the road of proc macros. Having generated code commited into vcs spreads up compilation, and it allows IDE code completion. IDEs aren't good with proc macros. |
@Mart-Bogdan That is tracked in issue #68. I agree that there are tradeoffs and it's definitely not yet clear whether a proc macro would be a good idea, but I think we should experiment with it. This issue, however, is about implementing the code generator in Rust, which is a necessary precondition for #68, but has value on its own. |
This would allow us to run code generation as part of build.rs (also see #21), and get rid of the C#/.NET dependency.
Blocked on having a suitable replacement for
Mono.Cecil
written in Rust, for reading the IL metadata.Update: The easiest approach is probably to port https://github.com/Microsoft/xlang/tree/master/src/library/impl/meta_reader (modern C++, MIT licensed) to Rust (as an external crate).
The text was updated successfully, but these errors were encountered: