RFC 0356: No prefixes in module names (naming convention)

libs (convention)

Summary

This is a conventions RFC that proposes that the items exported from a module should never be prefixed with that module name. For example, we should have io::Error, not io::IoError.

(An alternative design is included that special-cases overlap with the prelude.)

Motivation

Currently there is no clear prohibition around including the module's name as a prefix on an exported item, and it is sometimes done for type names that are feared to be "popular" (like Error and Result being IoError and IoResult) for clarity.

This RFC include two designs: one that entirely rules out such prefixes, and one that rules it out except for names that overlap with the prelude. Pros/cons are given for each.

Detailed design

The main rule being proposed is very simple: the items exported from a module should never be prefixed with the module's name.

Rationale:

Downsides:

Overall, the RFC author believes that if this convention is adopted, confusion around redefining prelude names would gradually go away, because (at least for things like Result) we would come to expect it.

Alternative design

An alternative rule would be to never prefix an exported item with the module's name, except for names that are also defined in the prelude, which must be prefixed by the module's name.

For example, we would have io::Error and io::IoResult.

Rationale:

Downsides: