On Thursday, December 26, 2019 at 10:14:04 AM UTC+1, Mohammad wrote: ... > So, I have started to revise some my plugins with 10s or more of global > vars! >
Plugins should only define global variables / macros, that they want to expose to users. This helps to avoid "name clashes". Which I think is the main reason for this "rule" > I wish to know is there any cost for \import in many tiddlers use those > macros? > I think it's the same, as if you use global macros. Global macros use the <$importvariables widget and \import does the same. Using the \import pragma will marginally speed-up variable lookup, BUT on the other hand deleting and creating those variables dynamically may outweight the speed-up. BUT *without exact measurements this* will be "premature optimization <https://en.wikipedia.org/wiki/Program_optimization#When_to_optimize>" which *is a time wasting task.* > and what is the recommended practice here? > As I wrote. Plugins should use global macros only if they can be used by the end-user. If they are used plugin internal, it may be worth to work with \import pragma. But only experiments can tell, if this is possible. have fun! mario -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/2efc721b-6691-4acf-bb2a-7759a5b873ea%40googlegroups.com.

