Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decide whether to eliminate the prelude_bazel file #11946

Closed
brandjon opened this issue Aug 13, 2020 · 3 comments
Closed

Decide whether to eliminate the prelude_bazel file #11946

brandjon opened this issue Aug 13, 2020 · 3 comments
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Starlark-Integration Issues involving Bazel's integration with Starlark, excluding builtin symbols type: process

Comments

@brandjon
Copy link
Member

(See also previous discussion in #1674 and #3835.)

Separate from the issue of how the prelude file is technically loaded (#11940), and whether it should be restricted to only contain load() statements, we need to decide whether we want to eventually eliminate it altogether. That is, we need to decide if it's a good idea to allow users to customize the set of predeclared symbols in their BUILD files.

I recently learned that my strongest objection to the prelude doesn't apply anymore: I was worried about the prelude file leading to repos not being composable, but it turns out that so was everyone else, so now the prelude only applies within the repo where it's defined (#3991).

So the remaining arguments against the prelude are:

  • It's harder to read and understand BUILD files without any context on the repo you're looking at (spooky action at a distance).
  • Changes to the prelude, or its transitive dependencies, trigger reevaluation of every package. That is, it encourages unnecessary (implicit) load() dependencies.

The argument in favor of keeping it is that it's convenient, and allows you to put Starlark rules on the same footing as native rules in terms of their implicit availability in the BUILD environment.

@brandjon brandjon added P2 We'll consider working on this in future. (Assignee optional) type: process team-Starlark labels Aug 13, 2020
@alandonovan
Copy link
Contributor

The argument in favor of keeping it is that it's convenient, and allows you to put Starlark rules on the same footing as native rules in terms of their implicit availability in the BUILD environment.

The way to put every rule on the same footing is to require that each is explicitly loaded from a .bzl file, even if their implementation is currently built-in. Isn't that a goal of all our Starlarkification efforts? If we could wave a wand and replace every implicit use of a native rule by an explicit load statement for that rule, wouldn't we do that?

The other argument for keeping it is that some users are already depending on it (see #11940 (comment)) as a hook for adding common behavior to every package. Convenient though it may be, I would argue that it is an abuse of an undocumented implementation detail (see #1674) and another form of spooky action at a distance. The specific use-case described in the latter issue could be addressed adding an explicit macro call at the bottom of every BUILD file. (This might make the macro simpler and more flexible as the rules would then exist at the time of the call.)

@brandjon brandjon added team-Starlark-Integration Issues involving Bazel's integration with Starlark, excluding builtin symbols and removed team-Starlark labels Feb 15, 2021
@brandjon brandjon added P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed P2 We'll consider working on this in future. (Assignee optional) labels Oct 26, 2022
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Dec 31, 2023
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage in a comment here and we'll take a look. Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Starlark-Integration Issues involving Bazel's integration with Starlark, excluding builtin symbols type: process
Projects
None yet
Development

No branches or pull requests

2 participants