You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -38,40 +36,47 @@ It is left to the implementation how to use this information.
38
36
"nothing"
39
37
```
40
38
41
-
# Advantages
39
+
# Arguments
42
40
[advantages]: #advantages
43
41
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.
59
52
60
53
# Alternatives
61
54
[alternatives]: #alternatives
62
55
63
56
- Never introduce backwards-incompatible changes to the language.
64
57
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.
66
61
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.
68
63
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.
70
74
71
75
- Use a magic string that is incompatible with evaluators prior to the feature, e.g. `%? Nix <version>`.
72
76
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.
75
80
76
81
# Unresolved questions
77
82
[unresolved]: #unresolved-questions
@@ -82,4 +87,4 @@ It is left to the implementation how to use this information.
82
87
# Future work
83
88
[future]: #future-work
84
89
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