Skip to content

Decide whether to eliminate the prelude_bazel file #11946

Closed as not planned
Closed as not planned

Description

@brandjon

(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.

Activity

  1. added
    P2
    on Aug 13, 2020
  2. alandonovan commented on Aug 17, 2020

    @alandonovan
    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.)

  3. added
    team-Starlark-Integration
    and removed on Feb 15, 2021
  4. added
    P4
    and removed
    P2
    on Oct 26, 2022
  5. github-actions commented on Dec 31, 2023

    @github-actions

    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.

  6. added
    stale
    on Dec 31, 2023
  7. github-actions commented on Mar 31, 2024

    @github-actions

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4staleteam-Starlark-Integrationtype: process

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions