Some documentation questions:
- Macro Pitfalls includes the following on performance of global macros:
Global Macro Definitions defined with the SystemTag: $:/tags/Macro suffer from poor performance because every macro has to be parsed regardless of whether it is actually used.
Furthermore, the way that definitions are imported means that updating a tiddler tagged SystemTag: $:/tags/Macro will cause the entire page to be refreshed.
Since the tiddler is contrasting macros with procedures/functions/custom widgets, this leads me to assume that the new macro alternatives do not have the same performance implications and/or are not imported in the same way.
- Is this true? I can’t find anything explicitly discussing the performance of the new 5.3.0 features.
- However, Procedure Definitions does explicitly mention the
$:/tags/Macrotag as a means of creating for creating global procedures. - Are procedures handled differently than macros with the same tag, or are the docs only suggesting that we should be using the
$:/tags/Macro/Viewand$:/tags/Macro/View/Bodytags instead, and thus cutting down on the truly “global”?
- Also on Procedure Definitions—this seems like it’s probably just a copy-paste error:
- I assume the tiddler should be referring to “procedures” and using
\procedureinstead.
- Global functions and custom widgets?
- My understanding is that both can also be made global with the
$:/tags/Macrotag, but this isn’t explicitly mentioned in the documentation. The Custom Widgets tiddler does explain that custom widgets are a special kind of procedure, so perhaps it goes without saying, but I think it ought to be mentioned on the Functions tiddler, at least.
- Checking my understanding of functions…
Since\function my-functionis a shortcut for definingmy-functionwith a<$set>widget (and, potentially, a narrower scope), I’d assume that a function using a TextReference (like\function my-function(parameter:"2") [<parameter>multiply[1.5]add{!!test}]) would destroy and re-render the entire contents of the tiddler in which it appeared if the value of the “test” field changes. This seems to be borne out in my testing.Is there any work-around for this? Or does best practice simply advise against defining functions that incorporate TextReferences (and, I imagine, against making any of them global?)
Edit for posterity: Not a \function issue; I’d misdiagnosed an unrelated issue with text-input widgets, now fixed.
