Skip to content

Commit 04a6fc1

Browse files
rewrite arguments to be more precise
1 parent 02e3126 commit 04a6fc1

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

rfcs/0137-nix-language-version.md

+32-27
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ related-issues: https://github.com/NixOS/nix/issues/7255
1111
# Summary
1212
[summary]: #summary
1313

14-
Add a mechanism to determine which version of the Nix language grammar to use for parsing Nix files.
14+
Introduce a convention to determine which version of the Nix language grammar to use for parsing a Nix file.
1515

1616
# Motivation
1717
[motivation]: #motivation
1818

1919
Currently it's impossible to introduce backwards-incompatible changes to the Nix language without breaking existing setups.
20-
This proposal is an attempt to overcome that limitation.
20+
This proposal is first step towards overcoming that limitation.
2121

2222
# Detailed design
2323
[design]: #detailed-design
@@ -26,9 +26,7 @@ Introduce a magic comment in the first line of a Nix file:
2626

2727
#? Nix <version>
2828

29-
where `<version>` is a released version of Nix the given file is known to work with.
30-
31-
It is left to the implementation how to use this information.
29+
where `<version>` is a released version of Nix the given file is intended to work with.
3230

3331
# Examples and Interactions
3432
[examples-and-interactions]: #examples-and-interactions
@@ -38,40 +36,47 @@ It is left to the implementation how to use this information.
3836
"nothing"
3937
```
4038

41-
# Advantages
39+
# Arguments
4240
[advantages]: #advantages
4341

44-
- Backwards compatible
45-
- Visually unintrusive
46-
- Self-describing and human-readable
47-
- Opt-in until the feature is implemented in Nix *and* the first backwards-incompatible change to the language is introduced.
48-
- Follows a well-known convention of using [magic numbers in files](https://en.m.wikipedia.org/wiki/Magic_number_(programming)#In_files)
49-
- Encourages, but does not require the Nix evaluator to deal with backwards-incompatible changes in a principled manner.
50-
51-
# Drawbacks
52-
[drawbacks]: #drawbacks
53-
54-
- The syntax of the magic comment is arbitrary.
55-
- At least one form of comment is forever bound to begin with `#` to maintain compatibility.
56-
- There is a chance of abusing the magic comment for more metadata in the future.
57-
Let's avoid that.
58-
- It requires effort to implement an appropriate system to make use of the version information.
42+
* (+) Encourages developing Nix to deal with changes to the Nix language in a principled manner.
43+
* (+) Backwards-compatible
44+
* (+) Allows for gradual adoption: opt-in until semantics is implemented in Nix *and* the first backwards-incompatible change to the language is introduced.
45+
* (+) Visually unintrusive
46+
* (+) Self-describing and human-readable
47+
* (+) Follows a well-known convention of using [magic numbers in files](https://en.m.wikipedia.org/wiki/Magic_number_(programming)#In_files)
48+
* (-) The syntax of the magic comment is arbitrary.
49+
* (-) There is a chance of abusing the magic comment for more metadata in the future. Let's avoid that.
50+
* (-) At least one form of comment is forever bound to begin with `#` to maintain compatibility.
51+
* (-) It requires significant additional effort to implement and maintain an appropriate system to make use of the version information.
5952

6053
# Alternatives
6154
[alternatives]: #alternatives
6255

6356
- Never introduce backwards-incompatible changes to the language.
6457

65-
This is what has been happening so far, and required additions to be made very carefully.
58+
* (+) No additional effort required.
59+
* (-) Requires additions to be made very carefully.
60+
* (-) Makes solving some well-known problems impossible.
6661

67-
- Use a different versioning scheme for the Nix language that is decoupled from the rest of Nix.
62+
- Use the output of `builtins.langVersion` (currently undocumented) for specifying the version of the Nix language.
6863

69-
Although this can be done at any point in the future, because it's the evaluator that will read this information.
64+
* (-) `builtins.langVersion` is currently only internal and undocumented.
65+
* (-) Requires adding another built-in or command line option to the public API.
66+
* (-) Using a language feature requires an additional steps from users to determine the current version.
67+
* (+) We can add a command line option such that it is not more effort than `nix --version`.
68+
* (+) The Nix language version is decoupled Nix version numbering.
69+
* (+) It changes less often than the Nix version.
70+
* (-) That was probably due to making changes being so hard.
71+
* (-) There are two version numbers to keep track of.
72+
* (-) The magic comment should reflect that it's specifying the *Nix language* version, which would make it longer.
73+
* (-) Renaming the Nix language will be impossible once the mechanism is part of stable Nix.
7074

7175
- Use a magic string that is incompatible with evaluators prior to the feature, e.g. `%? Nix <version>`.
7276

73-
This would make clear to users that the file is not intended to be used without explicit handling of compatibility.
74-
Such a breaking change could be reserved for later iterations of how Nix encodes language version information.
77+
* (+) Makes clear that the file is not intended to be used without explicit handling of compatibility.
78+
* (-) Cannot be introduced gradually.
79+
* (+) Such a breaking change could also be reserved for later iterations of the Nix language.
7580

7681
# Unresolved questions
7782
[unresolved]: #unresolved-questions
@@ -82,4 +87,4 @@ It is left to the implementation how to use this information.
8287
# Future work
8388
[future]: #future-work
8489

85-
Determine what exaclty to do with the information given in the magic comment.
90+
Define semantics, that is, what exactly to do with the information given in the magic comment.

0 commit comments

Comments
 (0)