ratatui / ratatui-macros

Macros for simplifying boilerplate for creating UI using Ratatui.
https://ratatui.rs
MIT License
24 stars 2 forks source link

Consider rename to tui-macros #25

Closed joshka closed 4 months ago

joshka commented 5 months ago

It might be useful to be able to write some proc-macros as part of ratatui proper. The most obvious useful name for that package would be ratatui-macros. Do you think it would be reasonable to rename this package to tui-macros in keeping with the general naming approach for ratatui adjunct projects?

I've reserved https://crates.io/crates/tui-macros for this purpose.

@kdheepak

kdheepak commented 5 months ago

I was thinking we could add the proc macros to this repo, right? Do we need a tui-macros + ratatui-macros?

joshka commented 5 months ago

I'd like to be able to have proc macros that we can include by feature flags as part of using ratatui (similar to when you use clap derive / etc), but I don't think we want the macros already defined in this library to be that. A proc macro lib crate can only export proc macros and no other code publicly.

Specifically, I think we should vendor the stability library into ratatui until we find a way to get the syn v2 update PR merged (see https://github.com/ratatui-org/ratatui/issues/961#issuecomment-2017030044 for the motivation:

If this wasn't a proc macro I'd just say bring in the source code directly and use it. But we'd need a separate library for this. It's a shame ratatui-macros is already taken (that probably should have been named tui-macros) as that would be a good place for proc macros that are necessary to be able to build ratatui like this to live.

The alternative is find another crate name for that macro like ratatui-proc-macros or ratatui-stability, but those seem less ideal. I think it would be better to do this shuffle now while there's only 3 dependents on this crate (https://crates.io/crates/ratatui-macros/reverse_dependencies) than later or to have confusingly named crates.

Ideally, once the macros defined in this crate are stabilized, they probably should end up migrating into the main crate anyway.

If you're strongly against this change that's fine, we can work out a differnt name for the proc macro crate.

kdheepak commented 5 months ago

I’m not against it, I didn’t realize proc macros crates could only export proc macros and not other macros.

I’m down to co-opt this crate for ratatui proc macros. Depending on the current usage of this crate, we may not even need a tui-macros. My sense from discussions online and discord is that people aren’t using this although I haven’t looked on GitHub.

kdheepak commented 5 months ago

The alternative is to make ratatui-proc-macros and use that as a dependency in this crate and export both non proc and proc macros from this crate. ie ratatui-macros is what users would depend on and ratatui-proc-macros is what we use for development. I believe we can even do that in this same repo?

joshka commented 5 months ago

Nvm. The stability PR was just merged

kdheepak commented 4 months ago

I have reserved ratatui-macros-core and ratatui-macros-derive for proc macros in the future if we need them.