Hi Mohammad

Your conclusions are correct: macro parameters referenced as variables are 
inherited like any other variables.

To show what happens behind the scenes, a macro like this:

\define mymacro(a,b)
<$text text=<<__a__>>/>: <$text text=<<__b__>>/>.
\end

Would be equivalent to the following version that explicitly assigns to the 
variables:

\define mymacro(a,b)
<$set name="__a__" value="""$a$""">
<$set name="__b__" value="""$b$""">
<$text text=<<__a__>>/>: <$text text=<<__b__>>/>.
</$set>
</$set>
\end

Best wishes

Jeremy


> On 9 Aug 2019, at 09:29, Mohammad <[email protected]> wrote:
> 
> In https://tiddlywiki.com/ <https://tiddlywiki.com/prerelease/>
> create a new tiddler
> and copy paste the below script
> save and see the output
> 
> Code
> \define One(p1, p2)
> ;Inside One
> :This is p1 in One: <$text text=<<__p1__>> />
> :This is p2 in One: <$text text=<<__p2__>> />
> 
> !!Call Two without passing p1, p2
> 
> <<Two p3:300>>
> \end
> 
> \define Two(p3)
> ;Inside Two
> :This is p1 in Two: <$text text=<<__p1__>> />
> :This is p2 in Two: <$text text=<<__p2__>> />
> \end
> 
> <<One p1:100 p2:200>>
> 
> 
> Output
> 
> 
> Inside One
> This is p1 in One: 100
> This is p2 in One: 200
> Call Two without passing p1, p2
> 
> Inside Two
> This is p1 in Two: 100
> This is p2 in Two: 200
> 
> 
> That means scope of macro parameters span to all macro called from the main 
> macro!
> 
> Is this correct? Is it practice to acces macro parameters in this way from 
> other calling macros?
> 
> --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/dd722b10-dd34-477c-ab28-a7af336ac9f7%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/dd722b10-dd34-477c-ab28-a7af336ac9f7%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/5BEF3CAF-799E-4143-BE01-E7DD815823CE%40gmail.com.

Reply via email to