I took the example function from https://tiddlywiki.com/#Functions and saved it in a tiddler named function multiply-by-two
.
I tried to use the function in another tiddler like this:
{{[function multiply-by-two]}}
<<multiply-by-two 4>>
No luck.
I went to read the docs then tried
\import [[function multiply-by-two]]
<<multiply-by-two 4>>
This worked.
Is this the correct way? Is it common practice to have one tiddler per function like this (I think Grok TiddlyWiki suggests having many small tiddlers containing small atomic pieces of data, but I’ve also seen multiple functions/macros declared in the same tiddler)? Is the import mechanism transitive (as in if I have a tiddler function foo
, then a tiddler module bar
which imports function foo
, do I get access to function foo
if I import module bar
)?
While I understand (I think) the advantages of importing over sourcing, why didn’t the first version work?