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

Just Editions #1201

Open
casey opened this issue May 28, 2022 · 4 comments
Open

Just Editions #1201

casey opened this issue May 28, 2022 · 4 comments

Comments

@casey
Copy link
Owner

casey commented May 28, 2022

This is mostly copy-pasta'ed from my comment here.

Just is now 1.0, and has a strong commitment to backwards-compatibility. In practice, backwards-compatibility was important even before 1.0, since there have been enough justfiles out there for a while now that breaking things would have been really annoying for users.

However, time marches forward, and there will always be backwards-incompatible changes that seem desirable to introduce, and old mistakes that would be nice to fix.

To be able to make changes while preserving backwards compatibility, I suggest we steal Rust's concept of an edition. An edition is an opt-in set of backwards-incompatible changes. For just, it would work like this:

  1. We add a new feature that would be a breaking change, but we make it an opt-in setting, i.e. set good-thing := true, so that it doesn't break existing justfiles.
  2. We fix some old behavior that was bad, but which people might have been relying on, but we make it an opt-in setting, i.e. set dont-do-bad-thing := true, so that it doesn't break existing justfiles.
  3. Some time passes, and we get confident that good-thing and dont-do-bad-thing are good and useful enough that they should be true by default
  4. We create a new setting called edition, that takes a number. If you don't set it, it defaults to set edition := 1, which corresponds to the way just works now.
  5. We announce edition 2, which, if you do set edition := 2, turns on both good-thing and dont-do-bad-thing.

Pros:

  • We can make changes that are backwards compatible
  • We don't have to try to justify breaking edge-case behavior by telling ourselves "well this is really a bug so it's okay if we break existing justfiles"
  • Users don't need to micromanage their settings, they can just do set edition := LATEST_EDITION and get good defaults
  • No existing justfiles will be broken

Cons:

  • Users have to put set edition := 2 at the top of their justfile or else they get edition 1.
@michidk
Copy link
Contributor

michidk commented Jun 9, 2022

Great! Then we can finally make set windows-powershell := true (from #1050) the default in edition 2.

Edit: Just saw your comment on #1202 - your suggestion is even better

@casey
Copy link
Owner Author

casey commented Jun 18, 2022

@michidk The windows-shell setting landed in #1198, so it's available for use now. Definitely give it a whirl.

@neunenak
Copy link
Contributor

Rust-style editions are a good idea in general. set edition := LATEST_EDITION needs to be done exactly once per justfile, one time, and is one line long - that doesn't strike me as a very onerous change. The one annoying thing is that someone new to just who doesn't know what editions are might be confused about why the justfile they write without set edition has different behavior from what they expect, and this can be solved by making editions obvious in the documentation.

@tgross35
Copy link
Contributor

Editions sound nice! As long as the maintenance burden doesn't go up too much from maintaining multiple versions.

I wish there was a better way to use the latest edition by default so that set edition isn't even needed. Maybe it could be okay to default to the latest but emit a suggestion to pin if there is a failure due to something that changed between editions. Or allow setting default edition to latest as a global setting.

What sort of changes would come with the next edition? Some random possible issues and other thoughts:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants