Skip to content

Predicate: builtins.functionArgsHaveElipses #7317

Closed as not planned
Closed as not planned

Description

@alex-ameen

The name could use some workshopping.

Is your feature request related to a problem? Please describe.
callPackage style auto-args functions are powerful, but without visibility on the use of elipses - wrapping functions is messy and full of pitfalls.

Knowledge of whether a function accepts elipses would allow wrapper routines to know that they should accept and potentially process elipsed args.

Aside from making function wrapping more predictable, this is useful for dynamic type/signature checking, logging, and documentation generation.

Describe the solution you'd like
A simple predicate builtin. The implementation would be nearly identical to functionArgs but returns true/false when isformals->elipses is set.

Describe alternatives you've considered
I've used functors to carry meta fields such as __functionArgs = { foo = true; "_..." = false; } or _functionMeta.elipsedArgs = true; I've been able to simplify wrappers in a subset of my own code, but this is tedious and is hardly a good reason to use a functor rather than a function in most cases.

Additional

As an extension this might also be used to indicate whether {x, ...}: is used to drop fields, or if {x, ...} @ all: was used to hide them from functionArgs.

The use case there being that for dynamic checking the first category of usage is a form of intersectAttrs and the second is an actual variadic function.

This has more niche utility but since the fields are just sitting there in C you might as well cover all of the function introspection info. I don't feel particularly strongly about "@" though.

Activity

  1. added
    feature
    on Nov 18, 2022
  2. infinisil commented on Nov 18, 2022

    @infinisil
    Member

    It is possible to get that information already, but it's a bit hacky 😅 NixOS/nixpkgs#194992

  3. alex-ameen commented on Nov 19, 2022

    @alex-ameen
    ContributorAuthor

    It is possible to get that information already, but it's a bit hacky 😅 NixOS/nixpkgs#194992

    This is awesome. I'm so proud of you 😄

  4. added a commit that references this issue on Sep 10, 2023
  5. tomberek commented on Aug 13, 2026

    @tomberek
    Contributor

    Closing as stale. Re-open if needed.

  6. nixos-discourse commented on Nov 9, 2026

    @nixos-discourse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions