sudoblockio / tackle

Tackle is a programmable configuration language for building modular utilities, code generators, and CLIs with schema validation baked in.
Apache License 2.0
51 stars 2 forks source link

Return Key #245

Open robcxyz opened 8 months ago

robcxyz commented 8 months ago

Return Key

Create a special key for returning the value when parsing

Overview

Blocked by return-hook

Currently when a declarative hook is called with an exec, the entire context is parsed with a special field for returning the appropriate value (return) being used to specify what the result is of that parsing.

This proposal would modify the parsing behaviour so that special keys can be used to indicate whether a variable is returned.

Examples

Normal parsing


foo: bar

return->: return {{foo}}

Macros


foo: bar

return->: return {{foo}}

Then move to using return hook.


foo: bar

tmp:

  ->: return {{foo}}