rfcs
rfcs copied to clipboard
[RFC 0181] List index syntax
When writing Nix code, it is relatively uncommon to want to index into a list, and
builtins.elemAtsuffices.
My 2cents is that I'd still prefer the simplicity of builtins.elemAt than introducing new syntax. The usability of nix repl is poor compared to other lisp languages. However, maybe that's something can be worked on the tooling level so that writing and interacting Nix code in repl can be the same experience as writing Nix code other places.
Thus, if exploring data in a REPL is the only motivation for introducing this new syntax, I feel like it doesn't hold a very strong argument this case.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2024-08-05/50170/1
I suggest adding the expr.(3) or expr.(n) variant to the proposal as it's the least confusing option:
- No issues with floats.
- No issues with symbols or letters attached to the right.
- No issues with sets;
.(a)and.("a")are already prohibited, ensuring no conflict with existing Nix code. - No issues with spacing;
expr.(a)has the same meaning regardless of spacing:expr.(a)isexpr .(a)isexpr. (a)isexpr . ( a ) - Unlike
[], priorities inside()are straightforward:expr.(a b)behaves likeexpr.${a b}. - Simplifying
expr.(3)toexpr.3could be allowed in unambiguous cases, making it as intuitive as any other()-removal, unlike[]adding/removals, which feel counterintuitive.
i.e. moving towards non-literal indexes will look like:
😺 expr.3 <-> expr.(3) -> expr.(a) -> expr.(a+1) -> expr.(f a)
vs
😿 expr.3 <-> expr.[3] -> expr.[a] -> expr.[(a+1)] -> expr.[(f a)]
or
😭 expr.3 <-> expr.$[3] -> expr.$[a] -> expr.$[(a+1)] -> expr.$[(f a)]
I personally find it fairly confusing to use parentheses in syntax that is not a grouping operator. We already have a precedent for it in the language, inherit (from) and I really dislike it as well.
We already have a precedent for it in the language,
inherit (from)and I really dislike it as well.
Off-topic: I think we lost a great chance for suggesting from lib inherit cmakeBool mesonBool;...
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2024-09-02/51514/1
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2024-09-16/52224/1
I am inclined to shepherd this for the sake of advancing the RFC, however I am not so sure if I can deal with three RFCs at the same time.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2024-09-30/53690/1
RFCSC: @AndersonTorres if you are able to spare the time it would be much appreciated as that would be enough to complete the shepherd team and move the RFC forward.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2024-10-28/55095/1
OK then, I recruit myself as shepherd.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2024-11-11/55888/1
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2024-11-25/56591/1
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2024-12-09/57636/1
Brief update: All shepherds (and the author) now joined the Matrix channel and we're having some initial discussions.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/lastmodified-attribute-mismatch-in-input-lastmodified-0/58395/1
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2025-01-06/58396/1
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2025-01-20/59113/1
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2025-02-03/59763/1
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/alternatives-to-with-expression/60272/2
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2025-02-17/60444/1
Brief update: I initiated some discussions in the Matrix room, waiting for the shepherds/author to respond (ping @rhendric, @AndersonTorres, @inclyc)
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2025-03-03/61097/1
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2025-03-17/61795/1
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2025-03-31/62432/1
RFCSC: @infinisil are there any updates on this PR? What needs to be done to move it forward?
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2025-04-28/63639/1
RFCSC:
Since there has been little activity for quite a while, we'll draft this in the next RFCSC meeting (2 weeks from now), unless the shepherds indicate that they'll pick this back up soon.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/rfcsc-meeting-2025-05-12/64183/1