Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add named ellipsis #5590

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

Synthetica9
Copy link
Member

@Synthetica9 Synthetica9 commented Nov 17, 2021

This PR adds a new language feature: named ellipsis.

nix-repl> ({ x, ... @ y } : y)  { x = 1; a = 1; }
{ a = 1; }

Often, we see the following pattern:

{ foo, bar, ... } @ args:
  let
    strippedArgs = builtins.removeAttrs args [ "foo" "bar" ];
  in
    ...

This is error-prone and repeats all the formal arguments. With this PR, this can be replaced with:

{ foo, bar, ... @ strippedArgs }:
  ...

TODO

  • Write an RFC to get this properly discussed in the community
  • Hide this behind a flag
  • Write tests
  • Write documentation

@domenkozar
Copy link
Member

NixOS/rfcs#58

@stale
Copy link

stale bot commented Jun 12, 2022

I marked this as stale due to inactivity. → More info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants