From 5fda3ff87be75e49e6ae428b48f626a7aaf6b77e Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Thu, 14 Nov 2019 09:25:54 +0100 Subject: [PATCH 01/14] Create 0057-named-ellipses.md First draft --- rfcs/0057-named-ellipses.md | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 rfcs/0057-named-ellipses.md diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md new file mode 100644 index 000000000..154d7d1e6 --- /dev/null +++ b/rfcs/0057-named-ellipses.md @@ -0,0 +1,53 @@ +--- +feature: Named Ellipses OR function argument consistency +start-date: (fill me in with today's date, YYYY-MM-DD) +author: @deliciouslytyped +co-authors: (find a buddy later to help our with the RFC) +shepherd-team: (names, to be nominated and accepted by RFC steering committee) +shepherd-leader: (name to be appointed by RFC steering committee) +related-issues: (will contain links to implementation PRs) +--- + +# Summary +[summary]: #summary + +It should be possible to bind ellipses to a name in a function argument definitions like `{ a, ...@extra }: null`, and `{ a, extra@... }: null`. This makes intuitive sense, and would remove the need for a lot of uses of `removeAttrs` that really just want to refer to the contents of ellipses. + +# Motivation +[motivation]: #motivation +This is pretty simple so it#s redundant with the summary: +- I think it makes sense to be able to refer to "the rest of the arguments" as a first class object +- This should also allow nixing a lot of usages of the `removeAttrs` pattern + +# Detailed design +[design]: #detailed-design + +Help? + +This is the bulk of the RFC. Explain the design in enough detail for somebody +familiar with the ecosystem to understand, and implement. This should get +into specifics and corner-cases, and include examples of how the feature is +used. + +# Drawbacks +[drawbacks]: #drawbacks +None? +This implements syntax that would not have worked before and so in theory shouldn't cause breakage in the Nix ecosystem. [Citation Needed] + +# Alternatives +[alternatives]: #alternatives +None? + +Not doing this would not have any major impact besides not making nix and nixpkgs nicer to use. + +# Unresolved questions +[unresolved]: #unresolved-questions +Should scope of this be expanded to binding any function argument to new names - for consistency, even though that might be considered redundant? + + +# Future work +[future]: #future-work +None? + +# Bibliography +Named ellipses - https://github.com/NixOS/nix/issues/2998 From c4f6cc9889f5257142416e65ace446132f963727 Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Thu, 14 Nov 2019 09:27:36 +0100 Subject: [PATCH 02/14] Update 0057-named-ellipses.md markdown fix --- rfcs/0057-named-ellipses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index 154d7d1e6..9700e5178 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -1,7 +1,7 @@ --- feature: Named Ellipses OR function argument consistency start-date: (fill me in with today's date, YYYY-MM-DD) -author: @deliciouslytyped +author: deliciouslytyped co-authors: (find a buddy later to help our with the RFC) shepherd-team: (names, to be nominated and accepted by RFC steering committee) shepherd-leader: (name to be appointed by RFC steering committee) From 1b74fac4836d1f1987e5b9199df928c7e801535c Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Thu, 14 Nov 2019 09:36:04 +0100 Subject: [PATCH 03/14] Update 0057-named-ellipses.md todo --- rfcs/0057-named-ellipses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index 9700e5178..d0efc26be 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -17,7 +17,7 @@ It should be possible to bind ellipses to a name in a function argument definiti [motivation]: #motivation This is pretty simple so it#s redundant with the summary: - I think it makes sense to be able to refer to "the rest of the arguments" as a first class object -- This should also allow nixing a lot of usages of the `removeAttrs` pattern +- This should also allow nixing a lot of usages of the `removeAttrs` pattern TODO: substantiate this # Detailed design [design]: #detailed-design From c38f79a2c902fb275c27b05f1e0e0728917c9eec Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Thu, 14 Nov 2019 09:42:39 +0100 Subject: [PATCH 04/14] Update 0057-named-ellipses.md example --- rfcs/0057-named-ellipses.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index d0efc26be..332aad31d 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -22,6 +22,8 @@ This is pretty simple so it#s redundant with the summary: # Detailed design [design]: #detailed-design +`{...@extraargs}: extraargs` should yield an attrset the extra arguments "in" `...`. + Help? This is the bulk of the RFC. Explain the design in enough detail for somebody From 23e51264b1478447fdd4b69ba1428846affb864c Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Thu, 14 Nov 2019 09:43:05 +0100 Subject: [PATCH 05/14] Update 0057-named-ellipses.md typo --- rfcs/0057-named-ellipses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index 332aad31d..4eb4d06b6 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -22,7 +22,7 @@ This is pretty simple so it#s redundant with the summary: # Detailed design [design]: #detailed-design -`{...@extraargs}: extraargs` should yield an attrset the extra arguments "in" `...`. +`{...@extraargs}: extraargs` should yield as an attrset the extra arguments "in" `...`. Help? From f1acf12a1229ef6086e6c68ca3cc7d878dea864a Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Thu, 14 Nov 2019 22:00:20 +0100 Subject: [PATCH 06/14] Update 0057-named-ellipses.md some cleaning --- rfcs/0057-named-ellipses.md | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index 4eb4d06b6..f850dccea 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -1,11 +1,12 @@ --- feature: Named Ellipses OR function argument consistency -start-date: (fill me in with today's date, YYYY-MM-DD) +start-date: 2019-11-14 author: deliciouslytyped -co-authors: (find a buddy later to help our with the RFC) +co-authors: none shepherd-team: (names, to be nominated and accepted by RFC steering committee) shepherd-leader: (name to be appointed by RFC steering committee) -related-issues: (will contain links to implementation PRs) +related-issues: + Named Ellipses - https://github.com/NixOS/nix/issues/2998 --- # Summary @@ -13,43 +14,21 @@ related-issues: (will contain links to implementation PRs) It should be possible to bind ellipses to a name in a function argument definitions like `{ a, ...@extra }: null`, and `{ a, extra@... }: null`. This makes intuitive sense, and would remove the need for a lot of uses of `removeAttrs` that really just want to refer to the contents of ellipses. -# Motivation -[motivation]: #motivation -This is pretty simple so it#s redundant with the summary: -- I think it makes sense to be able to refer to "the rest of the arguments" as a first class object -- This should also allow nixing a lot of usages of the `removeAttrs` pattern TODO: substantiate this +TODO: The latter point should be substantiated. # Detailed design [design]: #detailed-design `{...@extraargs}: extraargs` should yield as an attrset the extra arguments "in" `...`. -Help? - -This is the bulk of the RFC. Explain the design in enough detail for somebody -familiar with the ecosystem to understand, and implement. This should get -into specifics and corner-cases, and include examples of how the feature is -used. - # Drawbacks [drawbacks]: #drawbacks -None? -This implements syntax that would not have worked before and so in theory shouldn't cause breakage in the Nix ecosystem. [Citation Needed] +None? This implements syntax that would not have worked before and so in theory shouldn't cause breakage in the Nix ecosystem. [Citation Needed] # Alternatives [alternatives]: #alternatives -None? - Not doing this would not have any major impact besides not making nix and nixpkgs nicer to use. # Unresolved questions [unresolved]: #unresolved-questions Should scope of this be expanded to binding any function argument to new names - for consistency, even though that might be considered redundant? - - -# Future work -[future]: #future-work -None? - -# Bibliography -Named ellipses - https://github.com/NixOS/nix/issues/2998 From bde88ba37f940bb77067550632c2499408a06632 Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Fri, 15 Nov 2019 00:35:36 +0100 Subject: [PATCH 07/14] Update 0057-named-ellipses.md typo --- rfcs/0057-named-ellipses.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index f850dccea..2026e44d8 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -12,9 +12,9 @@ related-issues: # Summary [summary]: #summary -It should be possible to bind ellipses to a name in a function argument definitions like `{ a, ...@extra }: null`, and `{ a, extra@... }: null`. This makes intuitive sense, and would remove the need for a lot of uses of `removeAttrs` that really just want to refer to the contents of ellipses. +It should be possible to bind ellipses to a name in a function definition like `{ a, ...@extra }: null`, and `{ a, extra@... }: null`. This makes intuitive sense, and could remove the need for a lot of uses of `removeAttrs` that really just want to refer to the contents of ellipses. -TODO: The latter point should be substantiated. +TODO: The latter could be substantiated. # Detailed design [design]: #detailed-design From 776cb0f4f2578ed42bdfeaa6ac6880d97d3be647 Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Fri, 15 Nov 2019 00:42:04 +0100 Subject: [PATCH 08/14] accidentally interchanged some words --- rfcs/0057-named-ellipses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index 2026e44d8..756e4abea 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -12,7 +12,7 @@ related-issues: # Summary [summary]: #summary -It should be possible to bind ellipses to a name in a function definition like `{ a, ...@extra }: null`, and `{ a, extra@... }: null`. This makes intuitive sense, and could remove the need for a lot of uses of `removeAttrs` that really just want to refer to the contents of ellipses. +It should be possible to bind a name to ellipses in a function definition like `{ a, ...@extra }: null`, and `{ a, extra@... }: null`. This makes intuitive sense, and could remove the need for a lot of uses of `removeAttrs` that really just want to refer to the contents of ellipses. TODO: The latter could be substantiated. From 966bce48ce2e8c1062559a1bc7b50ce4aeba2ae3 Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Fri, 15 Nov 2019 01:14:24 +0100 Subject: [PATCH 09/14] added todo --- rfcs/0057-named-ellipses.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index 756e4abea..b6f345912 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -21,6 +21,8 @@ TODO: The latter could be substantiated. `{...@extraargs}: extraargs` should yield as an attrset the extra arguments "in" `...`. +TODO: consider what other languages like Haskell do + # Drawbacks [drawbacks]: #drawbacks None? This implements syntax that would not have worked before and so in theory shouldn't cause breakage in the Nix ecosystem. [Citation Needed] From 3fe2733cef78ead517ecac2c6a3dcc3dab1fbbc4 Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Fri, 27 Mar 2020 14:48:52 +0100 Subject: [PATCH 10/14] Update rfcs/0057-named-ellipses.md Co-Authored-By: Michael Raskin <7c6f434c@mail.ru> --- rfcs/0057-named-ellipses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index b6f345912..12318ede1 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -14,7 +14,7 @@ related-issues: It should be possible to bind a name to ellipses in a function definition like `{ a, ...@extra }: null`, and `{ a, extra@... }: null`. This makes intuitive sense, and could remove the need for a lot of uses of `removeAttrs` that really just want to refer to the contents of ellipses. -TODO: The latter could be substantiated. +Nixpkgs often gets commits like https://github.com/NixOS/nixpkgs/commit/a50653295df5e2565b4a6a316923f9e939f1945b with code that would be cleaner without the need for extra `removeAttrs`. # Detailed design [design]: #detailed-design From 30108be5b4640b178f6eea16a5202699a23ba5a5 Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Fri, 27 Mar 2020 14:49:30 +0100 Subject: [PATCH 11/14] Update rfcs/0057-named-ellipses.md Co-Authored-By: Michael Raskin <7c6f434c@mail.ru> --- rfcs/0057-named-ellipses.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index 12318ede1..4cccdc59d 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -25,7 +25,7 @@ TODO: consider what other languages like Haskell do # Drawbacks [drawbacks]: #drawbacks -None? This implements syntax that would not have worked before and so in theory shouldn't cause breakage in the Nix ecosystem. [Citation Needed] +This increases the amount of syntax Nix has, thus creating some maintenance cost both for Nix itself, and for tools intended to work with Nix syntax (from highlighting to hnix) # Alternatives [alternatives]: #alternatives From 8c4dd008bf390e8f4cf53bd0711ee1603594d527 Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Fri, 27 Mar 2020 14:51:51 +0100 Subject: [PATCH 12/14] Update rfcs/0057-named-ellipses.md Co-Authored-By: Michael Raskin <7c6f434c@mail.ru> --- rfcs/0057-named-ellipses.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index 4cccdc59d..71d735530 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -19,7 +19,8 @@ Nixpkgs often gets commits like https://github.com/NixOS/nixpkgs/commit/a5065329 # Detailed design [design]: #detailed-design -`{...@extraargs}: extraargs` should yield as an attrset the extra arguments "in" `...`. +The intent of this syntax is for `{...@args}:` to behave as close to the current `{...} @ args:` + as practical. As both `args @ {…}` and `{…} @ args` forms happen in Nixpkgs, both would be supported for named ellipses, too. As `args @ {args}: ` is an error in Nix because of duplicate argument names, so should be `{extra, ...@extra}: `. As `(a @ { ... }: a) {a=1;}` returns `{a=1;}`, so should `({ a @ ... }: a) {a=1;}`. ``` TODO: consider what other languages like Haskell do From 9044d4e41d9f1db6cf7a00390be94467ddcf4cb6 Mon Sep 17 00:00:00 2001 From: deliciouslytyped <47436522+deliciouslytyped@users.noreply.github.com> Date: Fri, 27 Mar 2020 14:58:20 +0100 Subject: [PATCH 13/14] Update 0057-named-ellipses.md Cleanup and small phrasing changes --- rfcs/0057-named-ellipses.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index 71d735530..f7bae51dd 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -1,5 +1,5 @@ --- -feature: Named Ellipses OR function argument consistency +feature: Named Ellipses start-date: 2019-11-14 author: deliciouslytyped co-authors: none @@ -19,8 +19,10 @@ Nixpkgs often gets commits like https://github.com/NixOS/nixpkgs/commit/a5065329 # Detailed design [design]: #detailed-design -The intent of this syntax is for `{...@args}:` to behave as close to the current `{...} @ args:` - as practical. As both `args @ {…}` and `{…} @ args` forms happen in Nixpkgs, both would be supported for named ellipses, too. As `args @ {args}: ` is an error in Nix because of duplicate argument names, so should be `{extra, ...@extra}: `. As `(a @ { ... }: a) {a=1;}` returns `{a=1;}`, so should `({ a @ ... }: a) {a=1;}`. ``` +The intent of this syntax is for `{...@args}:` to behave as consistent with `{...} @ args:` + as practical. As both `args @ {…}` and `{…} @ args` forms happen in Nixpkgs, both would be supported for named ellipses, too. + + As `args @ {args}: ` is an error in Nix because of duplicate argument names, so should be `{extra, ...@extra}: `. As `(a @ { ... }: a) {a=1;}` returns `{a=1;}`, so should `({ a @ ... }: a) {a=1;}`. ``` TODO: consider what other languages like Haskell do @@ -30,8 +32,4 @@ This increases the amount of syntax Nix has, thus creating some maintenance cost # Alternatives [alternatives]: #alternatives -Not doing this would not have any major impact besides not making nix and nixpkgs nicer to use. - -# Unresolved questions -[unresolved]: #unresolved-questions -Should scope of this be expanded to binding any function argument to new names - for consistency, even though that might be considered redundant? +Not doing this would not have any major impact besides not making Nix and nixpkgs nicer to use. From ff5795ae1b674555f00bec7e2dc7d84654e42cf0 Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Thu, 28 May 2020 14:26:42 +0200 Subject: [PATCH 14/14] Add shepherd team to metadata --- rfcs/0057-named-ellipses.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rfcs/0057-named-ellipses.md b/rfcs/0057-named-ellipses.md index f7bae51dd..6c910e78d 100644 --- a/rfcs/0057-named-ellipses.md +++ b/rfcs/0057-named-ellipses.md @@ -3,8 +3,8 @@ feature: Named Ellipses start-date: 2019-11-14 author: deliciouslytyped co-authors: none -shepherd-team: (names, to be nominated and accepted by RFC steering committee) -shepherd-leader: (name to be appointed by RFC steering committee) +shepherd-team: Eelco Dolstra, Michael Raskin, jD91mZM2 +shepherd-leader: Michael Raskin related-issues: Named Ellipses - https://github.com/NixOS/nix/issues/2998 ---