google / google/jsonnet

Shorthand for curried functions

Open
#223 1 comment 4 reactions 0 assignees View on GitHub
enhancement
Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Description

I love partial application, especially in the presence of HOFs, but especially with the [long syntax for lambdas](https://github.com/google/jsonnet/issues/129) it's currently pretty heavyweight to write those. Even if the syntax were more lightweight, I believe the following could be quite nice:

```
local foo(params1)(params2) = ...;
```

as shorthand for:

```
local foo(params1) = function (params2) ...;
```

Given that we already have the `local foo(params) = ...` as sugar for `local foo = function(params) ...`, it seems like iterating the current rule for each group of parentheses would be a nice generalization of the syntax. Same would apply to object "keys", as well as anonymous functions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.