[rust-dev] Requesting information (about globs, macros, subtyping)

John Clements clements at brinckerhoff.org
Thu Jul 17 09:28:37 PDT 2014

On Jul 16, 2014, at 10:54 AM, Gábor Lehel <glaebhoerl at gmail.com> wrote:

> Hello list,
> There are a couple of subjects I've been trying to ask for information about in comments here-and-there, and by and large not succeeding very much, so I thought I would try again, this time to a whole mailing list. (I was thinking of just asking on IRC, but perhaps an email conversation might benefit more people, and create a more permanent record for referring back to later.)
> There's four different subjects I'm curious about, and possibly they would be better off as separate threads, but I don't want to spam the list. Instead I'd like to request that anyone who wants to discuss these topics further beyond just trying to answer and discuss the listed questions (e.g. to discuss what Rust should do in the future, as opposed to background on its past and present) should start a new thread for it (edit the subject on the reply).
> So:
> 1. What are the problems with glob imports? I've encountered many references to these problems, but not much elaboration on them. Thinking here of consequences both for users of the language and for the implementation.

Wildcard (glob) imports make resolution/compilation more difficult, because you can’t tell what names are imported to a module without additional knowledge about that module. As just one example that just came up for me yesterday, doing macro expansion “right” requires knowing what names are present at the top level before expanding macros—but if you have circular dependencies, wildcard imports, and macros that expand into items, this may be… difficult.

> 2. It's been suggested, and also seems natural to me, to have macros scoped like all other items, i.e. to import them from modules with `use` (`use std::io::println;`) and to invoke them qualified with their path (`std::io::println!("for example")`). But there are allegedly problems with this, something to do with the fact that macros can also _create_ modules, if I'm remembering correctly. Could someone elaborate on these issues in greater detail?

I would like to see macros exported and imported like other bindings. There are some questions to answered, before this can be implemented.


More information about the Rust-dev mailing list