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

Gábor Lehel glaebhoerl at gmail.com
Wed Jul 16 10:54:45 PDT 2014


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.

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?

3. As far as I'm aware, subtyping in the current language arises only from
subtyping of lifetimes. Where is this important? One example was mentioned
in [Niko's recent blog post](
http://smallcultfollowing.com/babysteps/blog/2014/07/06/implied-bounds/).
Where else? Without this subtyping of lifetimes, what would break? How
burdensome would it be if one had to use explicit casts in those
circumstances?

4. Currently, items from parent modules are not visible in a given `mod`
without an explicit `use`, and the paths in `use` declarations are
by-default relative to the crate root, rather than to the current module
(while the latter can be specified explicitly with `self::`). Allegedly
this is because in Old Rust, it was (like everything) the other way around,
and it proved too hard to keep track of which names were coming from where.
My question is: Was this also the case for things declared in a parent
module within the same file, or was this mainly a problem for modules
defined out-of-line in a separate file, and these having access to things
from parent modules defined in different files? If it's the former
(problematic even within the same file), then examples would also be
appreciated. ([Relevant recent musings on my part.](
https://github.com/rust-lang/rfcs/pull/38#issuecomment-47533272))

Awaiting enlightening explanations with bated breath,
Gábor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140716/832c46bd/attachment.html>


More information about the Rust-dev mailing list