# Removing/changing the prelude?

**URL:** <https://internals.rust-lang.org/t/removing-changing-the-prelude/7972>\
**Category:** libs\
**Created:** [July 16, 2018, 10:34am UTC](https://internals.rust-lang.org/t/removing-changing-the-prelude/7972 "2018-07-16T10:34:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![yasammez](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/yasammez/32/4029_2.png) [@yasammez](https://internals.rust-lang.org/u/yasammez)\
**Post date:** [July 16, 2018, 10:34am UTC](https://internals.rust-lang.org/t/removing-changing-the-prelude/7972/1 "2018-07-16T10:34:31Z")

</div>

If big, backwards-compatibility breaking changes are on the table anyway, is it too late to ask for a removal of the prelude? Having to import everything, including std types would make code clearer and `no_std` environments easier to understand imho. Or is that idea silly?

---

<div class="post-metadata">

**Author:** ![Centril](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/centril/32/3334_2.png) [@Centril](https://internals.rust-lang.org/u/Centril)\
**Post date:** [July 16, 2018, 5:34pm UTC](https://internals.rust-lang.org/t/removing-changing-the-prelude/7972/2 "2018-07-16T17:34:05Z")

</div>

> [@Relative paths in Rust 2018](https://internals.rust-lang.org/t/relative-paths-in-rust-2018/7883/75):
>
> If big, backwards-compatibility breaking changes are on the table anyway, is it too late to ask for a removal of the prelude?

I'm personally quite opposed to such a change and think that it would make many common tasks pretty unergonomic. If anything, I think we should have a bigger prelude which includes things like `Arc` and `Rc`...

---

<div class="post-metadata">

**Author:** ![CAD97](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/cad97/32/3460_2.png) [@CAD97](https://internals.rust-lang.org/u/CAD97)\
**Post date:** [July 16, 2018, 6:08pm UTC](https://internals.rust-lang.org/t/removing-changing-the-prelude/7972/3 "2018-07-16T18:08:54Z")

</div>

> [@Relative paths in Rust 2018](https://internals.rust-lang.org/t/relative-paths-in-rust-2018/7883/75):
>
> Having to import everything, including std types would make code clearer and `no_std` environments easier to understand imho.

> [@Relative paths in Rust 2018](https://internals.rust-lang.org/t/relative-paths-in-rust-2018/7883/76):
>
> If anything, I think we should have a bigger prelude which includes things like `Arc` and `Rc` …

Overly aggressive solution: custom preludes! Allow specifying a module that is implicitly glob imported the way that `std::prelude::v1` is today.

Upsides: domain specific preludes.  
Downsides: differing preludes.

Of course, it's not too difficult to make your own prelude module and import that at the top of every file, and that's explicit. So maybe the solution is to [fix the `#[no_implicit_prelude]`/`#[no_prelude]` situation.](https://github.com/rust-lang/rust/issues/20561)

---

<div class="post-metadata">

**Author:** ![Centril](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/centril/32/3334_2.png) [@Centril](https://internals.rust-lang.org/u/Centril)\
**Post date:** [July 16, 2018, 6:12pm UTC](https://internals.rust-lang.org/t/removing-changing-the-prelude/7972/4 "2018-07-16T18:12:51Z")

</div>

[Custom preludes](https://github.com/rust-lang/rfcs/pull/890) due to @aturon seem like a nice idea to me (which can be done backwards compatibly afaik…). But I think custom preludes can be combined with a more expansive std prelude 🙂

---

<div class="post-metadata">

**Author:** ![Soni](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@Soni](https://internals.rust-lang.org/u/Soni)\
**Post date:** [July 16, 2018, 6:16pm UTC](https://internals.rust-lang.org/t/removing-changing-the-prelude/7972/5 "2018-07-16T18:16:19Z")

</div>

no\_prelude module attribute?

---

<div class="post-metadata">

**Author:** ![kennytm](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/kennytm/32/161_2.png) [@kennytm](https://internals.rust-lang.org/u/kennytm)\
**Post date:** [July 16, 2018, 9:15pm UTC](https://internals.rust-lang.org/t/removing-changing-the-prelude/7972/6 "2018-07-16T21:15:04Z")

</div>

`#![no_implicit_prelude]` already exists (and also see [RFC 501](https://github.com/rust-lang/rfcs/pull/501) “Consistent no-prelude attribute” and the issues linked to it).

---

<div class="post-metadata">

**Author:** ![withoutboats](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/withoutboats/32/4560_2.png) [@withoutboats](https://internals.rust-lang.org/u/withoutboats)\
**Post date:** [July 17, 2018, 4:41am UTC](https://internals.rust-lang.org/t/removing-changing-the-prelude/7972/7 "2018-07-17T04:41:24Z")

</div>

Regardless of whether or not it is a good idea, I do think it is too late to add something as dramatic as removing the prelude to our list of considerations for Rust 2018.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [March 25, 2019, 8:30am UTC](https://internals.rust-lang.org/t/removing-changing-the-prelude/7972/8 "2019-03-25T08:30:32Z")

</div>

Closed on March 25, 2019, 8:30am UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
