Since there hasn’t been a lot more iteration since that last survey post, I brought up this thread with the lang team in our most recent meeting. We had quite the epic discussion, discussing this thread, the proposals, and some of the tradeoffs between them. Somewhat surprisingly, we made some actual progress: we achieved a measure of consensus on some of the constraints we ought to be aiming for, which in turn helps to narrow down the ‘search space’ considerably.
First, there was a general consensus on the team that we really want to ensure co-existence and to avoid fallback. In particular, co-existence ensures a “graceful” introduction of the epoch (e.g., old code from stack overflow continues to have its unaltered meaning, though it may yield deprecation warnings). Fallback as a means to ensure co-existence is suboptimal, since it implies the potential for confusion (not so clear what a path means, particularly if e.g. you are moving back and forth between projects in distinct epochs). (There are also technical concerns about its feasibility.) This conclusion effectively rules out the leading-crate and leading-:: proposals, as both of those proposals require fallback to ensure co-existence.
There was also a general consensus that the 1path property would be valuable. As @joshtripplet put it, it seems a shame to come this far on the design, and yet not achieve the ability for a path to have uniform meaning. Not coincidentally, 1path and coexistence are naturally aligned, since both are achieved by introducing some new, unambiguous syntax for absolute paths.
Proceeding from there, the remaining proposals can basically be grouped into two camps:
- the leading-extern camp, which use keywords to identify an absolute path (in particular,
crate or extern).
- the leading-sigil camp, which use some form of sigil to identify an absolute path.
There are various known characteristics to both styles:
- leading-extern:
- pro:
- very readable, clear meaning
-
extern crate foo ==> use extern::foo is a kind of natural transition
-
use extern::{..} blocks can be seen as a clean, elegant syntax
- con:
- the “current crate” is no longer “parallel” with the extern crates
-
extern::foo is annoyingly long for inline use, pressing towards use statements
- similarly, if you don’t want to use a
use extern::{..} block, then very repetitive
- leading-sigil:
- pro:
- compact, suitable for use “inline”
- current crate is parallel with the extern crates
- con:
- sigils are always a learning hazard – they are hard to google, etc
- use statements are one of the first things you see when opening a crate
- what will be the visual impression from a “wall of sigils”?
Thus it’s probably best to try and focus on deciding between these two variants, if we can (without getting too stuck on what the sigil should be). At this point, it makes sense then to do some experimentation with the two styles. Try out different sigils. See how you feel and report back.