Skip to content

Shorthand for "pattern matching" on an object parameter #119

Open
@copumpkin

Description

@copumpkin

One thing I really miss when writing jsonnet after writing Nix for a while is the ability to deconstruct an object being passed in as a parameter. For example:

{ a, b, c }: a + b + c

is a one-parameter lambda (arguably the only sort that matters!) that expects the caller to pass it a dict with those three keys in it. You can also set defaults and match on the aggregate.

Would it be possible to get something similar in jsonnet?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions