On Tuesday, June 29, 2021 at 1:43:23 AM UTC+2 jn.pierr...@gmail.com wrote: > In a tiddlers tagged as #:/tags/Macro there is a public macro. It requires > other macros to achieve its goals, but these macros have no business being > used elsewhere. > > If I declare these macros in the same tiddler, they are exported. Bad :-( > To mitigate that, I have their name beginning with an underscore, meaning > to me not to use them elsewhere. > > But if two differentss macros tiddler both define their own _subMacro, > what _subMacro would be called? the one in the same tiddler or maybe yes, > maybe not, we can't say. This is the real problem. >
No. That's a feature. This behaviour allows the core to define sensible defaults, that can be overwritten by the user at any time. As I wrote in the other thread. \define xx() xx is a shortcut for <$set name=xx value=xx> tiddler content </$set> So *the local macro with the same name will always win!* If there is no local macro the predefined one will be used. Global macros have an order. Typically they are initializes in alphabetical order by the tag. So if you have title: a tags: $:/tags/Macro text: \define me() a and title: b tags: $:/tags/Macro text: \define me() b For global macros the rule is:* The last one wins* So yes. Your naming convention will influence the order, who macros are initialized. .. BUT since you know that now, you can *use it for your advantage* ;) > A suggestion: could we say that any macro whose name starts by _ or even __ for compatibility's sake, is not exported even within a macro tiddler? *No*, because this would be not backwards compatible. But you can use this convention if you like, but the system won't enforce it. The way it is designed is consistent but not always obvious. -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 tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/bede2e6d-7723-441f-ad26-c79300dca3dcn%40googlegroups.com.