Hi Mohammad

You can use the existing import pragma to bring in macro definitions from other 
tiddlers without cluttering the global name space. For example, you might have 
a global macro defined in a tiddler tagged $:/tags/Macro, and then put your 
local macros into tiddlers just tagged 
$:/tags/MyPublisher/MyPlugin/LocalMacros. Then, at the top of your global macro 
you’d bring in those local macros with:

\import 
[all[shadows+tiddlers]tag[$:/tags/MyPublisher/MyPlugin/LocalMacros]!has[draft.of]]

\define myPublicMacro()
…


Best wishes

Jeremy



> On 30 Aug 2019, at 05:47, Mohammad <[email protected]> wrote:
> 
> Description
> It is quite common when developing a macro to do a specific task, it needs 
> some auxiliary macros. For example I wrote a macro mySearch to do search in 
> tiddlers text field which itself call another macro to show the result 
> showResult in some specific format. Users only needs to call mySearch and not 
> showResult.
> 
> These global macros (tagged with $:/tags/Macro) are anywhere available and  
> make the whole namespace messy.
> 
> Proposal
> Like other programming language we can have sub macro or private members. For 
> example TW core can prevent access to all macros in a tiddler tagged with 
> $:/tags/Macro if their name meet some certian criteria for example: __NANE__  
> or __::NAME
> 
> Benefits
> A tiddler tagged with $:/tags/Macro with many macro variables in it acts like 
> a small namespace. Only certain macro can be called (are global) and other 
> follow the above rule only accessible from inside that tiddler. Tiddlywiki 
> will remain tidy, Global vars will not overwrite each other, ...
> 
> 
> --Mohammad 
>  
>  
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/7dd82716-23d8-4be5-abd6-2028bab54d8f%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/7dd82716-23d8-4be5-abd6-2028bab54d8f%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/B3F0566F-7DFD-4402-ACDA-C1EC83EA2731%40gmail.com.

Reply via email to