-
Notifications
You must be signed in to change notification settings - Fork 178
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
proc macros ergonomics for ICU4X #310
Comments
Reexport it from
There is no good solution here aside from splitting into an impl crate, sadly. In the future there may be better ways to do this, folks have been talking about it for a while, but there aren't any concrete plans. |
Did you mean |
Sorry, I meant |
Otherwise, yeah, you'll have to require people to import |
I don't think Someone created https://crates.io/crates/proc-macro-crate and I'll try that. |
Yeah but that won't be useful without the reexport. If you had a facade crate you could introduce the reexport there. |
I'm totally fine with having two lines in Cargo.toml with and without macros. I don't think it's un-ergonomic; it's just as easy as adding a feature to the dependency. It would be nice to get the tinystr name resolution problem resolved. I still am of the opinion that there is probably a way to solve it using |
I intend to merge #220 ASAP and we can work on ergonomics of it in a new PR. |
done. We still need to resolve the ergonomics question |
EDIT: Darn, the |
Const functions work perfectly with the @Manishearth, any sense about when |
Okay, I also do not see any sign of string/slice indexing operations. I saw it suggested in rust-lang/rust#52000 that this could change (allowing That being said, since we can pretty trivially implement things like
We can validate the subtags, but we can't parse the tl;dr: There are still several open questions on this thread. I would like to stick with a |
that sounds good to me. |
With #337 the core functionality seems to be working quite well. Thank you Shane! One limitation I found is that the macros crate expect there to be The solution is to unfortunately require:
This could be solved by https://crates.io/crates/proc-macro-crate if we're willing to take it. Then, we'd use it to differentiate between @sffc - what do you think? |
Copying my comment from #337 into here:
The limitation you found is bullet point 1 above. "proc-macro-crate" looks promising. It's worth trying if it works out of the box! |
Not quite done: #338 resolves |
With the merge of #338 we now can use proc macros from If used as a separate module it has to be loaded separately, but I'm going to close this issue and we can reopen with more narrow scope of ergonomics. |
Okay. I made a follow-up issue instead: #348 |
Rust is evolving its proc macros functionality, and we're already trying to use them.
I tried to write a patch that switches us to use
icu-locale-macros
that I added in #220 and there are two ergonomics issues that I think we should try to resolve:Imports
In the perfect world, I'd like to do:
It doesn't seem like I can add
icu-locale-macros
as defined in #220 as an optional dependency onicu-locale
because it creates a circular dependency.That's unfortunate.
We can workaround it by adding:
and then
That's unfortunate and I think it makes the experience worse, but I don't know if there's a good way out of it except of what I did in
unic-locale
with separatingicu-locale-impl
with code, thenicu-locale-macros
depend on it andicu-locale
depends on those two. That seems like a high maintenance overhead (I know that it is for releasingunic-locale
) and I'd love to avoid it, but I don't know how.tinystr
dependencyWith the current import of
and then
I'm seeing an error about unknown module
tinystr
and in result I need to add:to make it work.
That's unergonomic and I'd love to have
tinystr
in scope because it is used inicu-locale-macros
.Again, we could resolve it with moving all code in
icu-locale
toicu-locale-impl
and then havingicu-locale
be a wrapper that importsicu-locale-impl
,icu-locale-macros
andtinystr
but that feels wrong :(@Manishearth - can you recommend a path forward?
The patch I'm testing it on is based on #220, using Rust Beta (1.47) and
cargo +beta test
incomponents/datetime
with:The text was updated successfully, but these errors were encountered: