Skip to content

Where should we put macros? #351

Open
@ghost

Description

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 the task module? And why is println not in the io 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 have std::io::println instead of std::println.

So we're facing a dilemma: do we organize our macros in async_std more logically (unlike std) or just dump them all in the root module (like std)? Or, do we keep the current situation and have equivalents of macros from std 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions