google / google/jsonnet

RFE: semantics to allow closure calls to take place on non-closures

Open
#477 11 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Jsonnet
Stars
7.6k
Forks
475
PR merge metrics
No merged PRs in 30d

Description

It would be really nice to be able to write something like `std.makeArray(8, 0.0)`, or -- more to the point -- `std.makeArray(4, std.makeArray(5, std.makeArray(5, 0.0)))`, rather than `std.makeArray(4, function(_) std.makeArray(5, function(_) std.makeArray(5, function(_) 0.0)))`.

The easiest way I see to make that work is to add an application rule for non-functions that `\rule{e_0 ↓ e_0', e_0' ∈ {Number, String, Array, Object, Boolean, null}}{e_0(e_1 ... e_m) ↓ e_0})` (or such). This makes the language a little bit gross inasmuch as it makes static checking of it a little less useful, but on the other hand, it really does simplify the syntax for common uses of makeArray...

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.