Short Circuit Evaluation in TiddlyWiki

Short Circuit Evaluation is a technique where minimal evaluation is done while evaluating Boolean operators. An expression usually consists of more than one argument, and often we can determine the overall value for the expression, based of the first argument.

Short Circuit Evaluation in Programming - CodersLegacy

I want to see if there is such possibility with Filters in Tiddlywiki.

A real use case

In Mehregan, every tiddler has a set of smart tabs like Node Explorer.

These tabs contains microcontents about that tiddler. There are requests to show some indication like bubbles, or use different colors on those tabs are not empty.

The Node Explorer tab uses filters where all tiddlers examined against current tiddler for any kind of relationship. Is there a short circuit method to evaluate filter for node explorer?

Why? When there are many tiddlers open in story river, we have many complex filter evaluations.

1 Like


Some thoughts on this question

In some ways when you use a filter in tiddlywiki you are testing lists, if you use something like limit[1] or first[] then you are just asking if “one or more” items exist in the list, this may not seem like a “short circuit evaluation” but if the filters you are using, use the indexed filter operators then it may as well be.

Another approach to this kind of problem is the “proxy”, proxy here is used like when you give someone a “proxy to vote on your behalf”, that is if there is any information you can test that is equivalent, or somewhat equivalent to the actual question you would like to ask. Examples include;

  • The simplest example is if there is a true false switch - a value ion a field that says display here. Or one or more cascading true false tests eg; global flag with local override
  • [all[current]is[tiddler]!is[system]] excludes system and shadows because they may not be relevant to your solution. Note how this is also ONLY testing the current tiddler.
  • You could test for [all[current]has[tags]] for example to see if there is any tag what so ever, without iterating all tags on the current tiddler or in the whole wiki.

Perhaps you could provide specific conditions/filers you think may be too “Hungary” that we may find a short circuit, proxy or efficient test for?

I will try and look at the specific case and make some suggestions.

  • perhaps hover or css has something to offer
  • also building your own button driven tabs will allow more features including conditional tabs.

I don’t know if I understand you, but I think the cascade mechanism could be a solution.

A basic example wouldl be welcome.

I think you named the only real problem … When there are many tiddlers open …

If many tiddlers are open, most of them are out of view. So their content is updated, even if nobody can see them. …

So I think it’s the dynaview plugin that you need.

Just cover your “Node Explorer” content in a DIV with a class: tc-dynaview-track-tiddler-when-visible … That’s basically all you need to do. The rest is done by the plugin.

You don’t need to mess with the state tiddlers. They are only needed, if you want to create the sidebar behaviour of the demo page. … In the demo it’s hard to demonstrate, that the mechanism works, because if the mechanism works the elements are out of view. … So the state-tiddlers are only used to create a “dynamic” view in the right sidebar, to demonstrate how the plugin works.

Most real-world usecases don’t need to deal with that.


Thank you. This is promising, as it only renders the tiddler in view.

See Mehregan, Node Explorer.

I think cascades is not relevant here. All tiddlers have microcontent part, one of them is Node Explorer

Ah, ok. I didn’t understand the problem.

1 Like