Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Nicer syntax for higher level functions

Open
#1,002 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Domain
compilers

Research direction

The issue proposes arrow syntax for defining and using higher-order functions, with examples for nested functions and std.filter. Start by reviewing Jsonnet's language grammar and parser entry points, then find the syntax tests covering function expressions. Done means the proposed arrow forms are accepted consistently and existing function syntax remains covered.

Written by the indexing model from the issue text.

Description

I love the pure functional nature of Jsonnet! However, when trying to do things in a functional style, the syntax gets in the way a bit (not a lot, but a bit).

For example, defining higher level functions is a bit clumsy:

local f = function(x) function(y) function(z) z*y*z;

I think such functions would be more natural to use, and therefore get used more often, with more succinct syntax – and there's no need to invent anything fancy, since lots of other languages already use either a "fat" or a "thin" arrow, => or ->.

So the above snippet would become:

local f = x -> y -> z -> z*y*z;

This would also be nice and eligible for inline uses, e.g. std.filter(thing -> thing.isActive, things).

Hoping y'all think it makes sense! 🤞

Dominant language
Jsonnet
Stars
7.6k
Forks
477
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/jsonnet

All issues in google/jsonnet

Similar issues

More Compilers issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.