RSS Amplifier

Bit Maybe Wise · May 15, 2026

Tsonnet #41 - Call me maybe, but make it argless

0
Sign in to vote or save

This page did not load. You can still read it on the original site — the toolbar below keeps your place in the directory.

Fixing function calls with zero arguments, solved with a one-word grammar change.

Welcome to the Tsonnet series!

If you’re not following along, check out how it all started in the first post of the series.

In the previous post, we wrapped up function support with named parameters at call sites:

Oops, I forgot function calls without arguments.

Classic. I left them home alone.

Photo from https://www.businessinsider.com/photos-show-inside-real-life-home-alone-house-chicago-illinois-2020-12

What must be validated

Here’s what we need to handle:

local greet() = 'hello';
local make_obj() = { x: 1, y: 2 };
local apply(f) = f();
local obj = { m(): 7 };
{
  greet: greet(),
  obj: make_obj(),
  inline: (function() 42)(),
  applied: apply(function() 'world'),
  method_call: obj.m(),
}

Parsing

The fix is very straightforward. The only change required is substituting separated_nonempty_list by separated_list:

Every place we parse parameter or argument lists gets the same treatment: function definitions, object method definitions, function calls, and closures. Swap nonempty out, and zero-argument calls stop crashing the parser.

How could I forget this one? XD

Testing

A new sample and a cram test entry:

Zero arguments, zero drama.

Conclusion

Short one, but a necessary one. No-argument function calls were quietly broken, and the fix turned out to be a one-word change per grammar rule. Easy to overlook, easy to fix once you notice.

Next up: conditionals. The Jsonnet tutorial can’t wait forever.

The entire diff can be seen here.


Thanks for reading Bit Maybe Wise! Left no-arg calls home alone. Subscribe so you don’t miss when conditionals finally move in.

Read on bitmaybewise.substack.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.