rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

[RFC 0181] List index syntax

Open rhendric opened this issue 1 year ago • 31 comments

Rendered

rhendric avatar Jul 14 '24 21:07 rhendric

When writing Nix code, it is relatively uncommon to want to index into a list, and builtins.elemAt suffices.

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.

sg-qwt avatar Jul 15 '24 09:07 sg-qwt

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

nixos-discourse avatar Aug 05 '24 15:08 nixos-discourse

I suggest adding the expr.(3) or expr.(n) variant to the proposal as it's the least confusing option:

  1. No issues with floats.
  2. No issues with symbols or letters attached to the right.
  3. No issues with sets; .(a) and .("a") are already prohibited, ensuring no conflict with existing Nix code.
  4. No issues with spacing; expr.(a) has the same meaning regardless of spacing: expr.(a) is expr .(a) is expr. (a) is expr . ( a )
  5. Unlike [], priorities inside () are straightforward: expr.(a b) behaves like expr.${a b}.
  6. Simplifying expr.(3) to expr.3 could 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)]

vobloeb avatar Aug 12 '24 01:08 vobloeb

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.

piegamesde avatar Aug 12 '24 06:08 piegamesde

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;...

AndersonTorres avatar Aug 23 '24 15:08 AndersonTorres

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

nixos-discourse avatar Sep 02 '24 15:09 nixos-discourse

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

nixos-discourse avatar Sep 16 '24 15:09 nixos-discourse

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.

AndersonTorres avatar Sep 17 '24 01:09 AndersonTorres

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

nixos-discourse avatar Sep 30 '24 15:09 nixos-discourse

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.

kevincox avatar Oct 28 '24 15:10 kevincox

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

nixos-discourse avatar Oct 28 '24 15:10 nixos-discourse

OK then, I recruit myself as shepherd.

AndersonTorres avatar Oct 28 '24 21:10 AndersonTorres

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

nixos-discourse avatar Nov 11 '24 16:11 nixos-discourse

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

nixos-discourse avatar Nov 25 '24 19:11 nixos-discourse

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

nixos-discourse avatar Dec 19 '24 16:12 nixos-discourse

Brief update: All shepherds (and the author) now joined the Matrix channel and we're having some initial discussions.

infinisil avatar Jan 06 '25 16:01 infinisil

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

nixos-discourse avatar Jan 06 '25 16:01 nixos-discourse

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

nixos-discourse avatar Jan 06 '25 16:01 nixos-discourse

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

nixos-discourse avatar Jan 20 '25 16:01 nixos-discourse

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

nixos-discourse avatar Feb 03 '25 16:02 nixos-discourse

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

nixos-discourse avatar Feb 14 '25 00:02 nixos-discourse

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

nixos-discourse avatar Feb 17 '25 16:02 nixos-discourse

Brief update: I initiated some discussions in the Matrix room, waiting for the shepherds/author to respond (ping @rhendric, @AndersonTorres, @inclyc)

infinisil avatar Mar 03 '25 16:03 infinisil

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

nixos-discourse avatar Mar 03 '25 16:03 nixos-discourse

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

nixos-discourse avatar Mar 17 '25 16:03 nixos-discourse

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

nixos-discourse avatar Mar 31 '25 15:03 nixos-discourse

RFCSC: @infinisil are there any updates on this PR? What needs to be done to move it forward?

kevincox avatar Apr 29 '25 15:04 kevincox

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

nixos-discourse avatar Apr 29 '25 15:04 nixos-discourse

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.

GetPsyched avatar May 12 '25 15:05 GetPsyched

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

nixos-discourse avatar May 12 '25 15:05 nixos-discourse