Where should we put macros? #351
Labels
api design
Open design questions
feedback wanted
Needs feedback from users
question/feedback
A question or user feedback
Consider the following macros:
async_std::task_local
async_std::println
async_std::task::ready
They are not organized in a very sensible way. Why would
task_local
be in the root module and not in thetask
module? And why isprintln
not in theio
module if standard I/O functionality lives there?In the Rust standard library, all macros live in the root module. This is perhaps a historical artifact because macros couldn't be placed anywhere else until Rust 2018 (remember the age of
#[macro_use]
?). If the standard library was designed today, perhaps we'd havestd::io::println
instead ofstd::println
.So we're facing a dilemma: do we organize our macros in
async_std
more logically (unlikestd
) or just dump them all in the root module (likestd
)? Or, do we keep the current situation and have equivalents of macros fromstd
in the root module and place other macros elsewhere?Macros in the root module are also re-exported in the prelude (just like in
std
). However, other macros aren't.Opinions?
The text was updated successfully, but these errors were encountered: