Hi Mario, Many thanks for clarification. There is a trade off between using global and \import vars
On Thursday, December 26, 2019 at 2:47:24 PM UTC+3:30, PMario wrote: > > 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. > I think this is the rule I should follow > > But only experiments can tell, if this is possible. > Thanks again --Mohammad > > 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/ae20a95d-cba1-4409-bb0c-cbf1ed618f7f%40googlegroups.com.

