Filter parameters currently can be delimited by []
, {}
, or <>
. Recently I had the idea that it would be useful to allow parameters to also be delimited by either single quotes or double quotes. The behavior of these quotes would be identical to the square braces with the only difference being that square braces are allowed inside.
This would allow for filter expressions to be written “inline” for operators like subfilter
, filter
, etc. It would also allow the regular expression operator to have square braces directly within.
Examples:
[subfilter"[all[]] :map[split[]first[1]]"filter'[prefix["]]']
[regexp"[0-9]{2}"]
I admit the readability isn’t very good compared to the brackets, but it would be useful functionality to have. And it is consistent with the way that filter runs can already be delimited by single quotes, double quotes, or square braces. There the readability is better because filter runs are separated by spaces.
In another thread, @saqimtiaz mentioned he experimented with backticks as delimiter:
Here the backticks are not synonyms of the square braces, so the implementation would have been more complicated than what I’m suggesting. I wonder @saqimtiaz if you already considered my idea in the past?
Also in that thread @saqimtiaz mentions that the new feature of <>
delimited filter parameters allows arguments to be passed. Creative use of that feature allows passing subfilters inline just by using a specially crafted macro.
The two drawbacks of the angle bracket approach are:
- Angle brackets can’t be used inside (this breaks the use case I was playing with which sparked my ideas)
- It requires using textual substitution for the macro.
I’m looking for feedback on my idea, but already I feel the readability issue is a pretty big argument against it. And there may be other disadvantages I haven’t thought of.