pollypkg/polly

Switch Signals to a map structure

Opened this issue · 0 comments

Currently, signals are defined in PollyPackage as a list, for the reasons in the comment:

// NOTE This is a list instead of a struct so that we can allow duplication
// in the future. That would permit implementations of the "same" signal in
// different query languages. This would be somewhat analogous to
// function/method overloading - the consumer's value context can determine
// whether to use the e.g. promql or flux implementation (assuming both
// exist).
//
// TODO constrain name uniqueness within the list.
//
// @doc(metaschema)
signals?: [Signal, ...Signal]

Addressing list elements in CUE is just...super annoying. I already wrestled with it months ago with scuemata. It may get better, but i don't want to wait, and the justification in the comment is flimsy at best. So, better to use a map structure.