From previuous tiddlers I understood that in a filter .myfunction[] is equal to <.myfunction>.
And then I thought that it would mean that all[] would be the same as <all>. Which is not the case, but this is a little bit annoying that our beloved syntax as such discrepancies.
Whtever, in fact, my concern was about a filter function argument. I can code easily for “take the default input, but if it is void take the parameter, but if itself is void, take the current tiddler” as initial input. (by void, I mean satisfying is[blank]:
where unless would swap the input with its argument if tha latter is not blank. This filter operator would have to be coded in javascript. I can do that, this is not my question.
My question is: would other people be interested in such a filter operator?
Do you see a way to achieve the same behaviour that could be coded withou that new filter operator?
I wouldn’t call this a discrepancy even if .myfunction[] did equal <.myfunction>, because all isn’t a function, it’s a filter operator. A function isn’t fundamentally a filter operator; fundamentally, it’s a special way to define a variable. A function can also be used as a custom filter operator if it contains a period—which specifically differentiates it from the core operators, which don’t contain periods and aren’t variables.
You could argue that we should have an <<all>> variable, but I’m not sure what it would do, because a variable’s value is normally a single string, not a list (which is why we need workarounds like +[format:titlelist[]join[ ]] to convert a list to a single string that can be preserved in a variable). Logically I suppose that would make <<all>> = [all[]first[]], but that feels contrary to the normal meaning of “all”.
The \function f.test() [tag[HelloThere]] definition is similar to assigning a transclusion list {{{ }}} to a variable, except functions always return plain text.