In some programming languages, there are typically reserved words, such as let
, that cannot be used as variable names. So, does TiddlyWiki have similar restrictions on reserved words? And will such restrictions be added in future versions? Because I plan to create some entries with titles containing @
or #
, such as @apple
or #apple
. I am unsure if this will be affected, especially considering compatibility with versions after 5.4.0.
There are some restrictions for tiddler titles. Eg: | [ ] { }
– If you use them in the tiddler editor, you will get a message. – Those characters can cause problems with filters.
The other reserved prefix is $:/
for system tiddlers
@
and #
should not cause any problems.
Tiddlywiki is very permissive when it comes to variable names and there partners macros, procedures etc…
- Keep in mind it is more about how you reference the element such as using
<<varname>>
and<varname>
inside filters.
One idea is to set up a simple test;
<<varname>>
<$let varname="var value">
here=<<#varname>>
</$let>
This allows you to quickly test which var names are valid.
- The first line is to check if it already has a value.
If you or the system already defined that variable yes you may arguably want to avoid that name as setting an existing variable name effectivly sets a new local value.
- Tiddlywiki uses a prefix
tv-
varname for a set of system variables (tv=tiddlywiki variable) - Similarly you could do the same
Because you can set the value of a variable localy it is often possible to reuse a variable name even if its already in use, as long as you are not trying to access its earlier value, when the var/set/let or tiddler ends it will fall back to its previouse value.