[openstack-dev] [Heat] Conditionals, was: New function: first_nonnull

Zane Bitter zbitter at redhat.com
Tue Nov 11 17:09:18 UTC 2014


On 10/11/14 12:34, Alexis Lee wrote:
> Zane Bitter said on Fri, Nov 07, 2014 at 12:35:09AM +0100:
>> Crazy thought: why not just implement conditionals? We had a
>> proto-spec for them started at one point...
>
> I didn't know that was on the table :)
>
> How about we support YAQL expressions? https://github.com/ativelkov/yaql
> Plus some HOFs (higher-order functions) like cond, map, filter, foldleft
> etc?
>
> Here's first_nonnull:
>
>    config:
>      Fn::Select
>        - 0
>        filter:
>          - yaql: "$.0 != null"
>          - <item1>
>          - <itemN>
>
> Making the 'yaql' function eponymous means we can easily plug other
> expression languages in later if we choose.
>
> We can restrict the functions available to YAQL expressions to avoid a
> halting problem.
>
> Each HOF will know how to populate the context for subordinate YAQL
> expressions. When used outside a HOF, only add a default context of
> parameters and input_values.
>
> Is this totally crazy or worth spec-ifying?

The first one.




More information about the OpenStack-dev mailing list