Re: [tw5] protected macros

2021-06-29 Thread Mohammad Rahmani
Hi Jean-Pierre,
 This is quite common in other programming languages! It is also possible
in TW!
 Put all those sub-macros in another tiddler say $:/jean/macros/utility NOT
tagged with $:/tags/Macro
 In the main macro after definition line (header) \import
$:/jean/macros/utility

That's all! There are some good hints in TW-Scripts.

Best wishes
Mohammad


On Tue, Jun 29, 2021 at 4:13 AM Jean-Pierre Rivière <
jn.pierre.rivi...@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.
>
> same question if my macro tiddler has _myStuff macro and a non macro
> tiddler define a macro also called _myStuff and use it: which one would be
> called? That's a variation from the previous question.
>
> I know I can have _mySuff macro into a separate non macro tiddler, and
> \import it within my macro tiddler. That way my macro tiddler is 100%
> functionaal and _myStuff is not exported but creating another tiddler is a
> problem in itself: it's yet another tiddler, it's not that a good idea
> because it's only there for a single tiddler, and I would need to have a
> name for it. It would complexify my naming convention which is already a
> lengthy paper... and I would have to decide which idea is the one I shall
> get. to be honest, my macro fubar for the foo matter is in
> $:/user/foo/macros/fubar. So where should _sub4fubar be ?
> $:/user/foo/macros/fubar/private would do but then $:/user/foo/macros/fubar
> would both be a file and a directory, whis is a no go. So no way to store
> anything below the macro name. $:/user/foo/privateMacros/fubar perhaps?
> or  $:/user/foo/private/macros/fubar ? I could have some macro for a bar
> filter in $:/user/foo/private/filters/fubar but then I don't have the same
> meaning for macros there than in the $:/user/foo/macros/fubar where
> "macros" tells that here are macros but in $:/user/foo/private/macros/fubar
> "macros" tells that this concerns a macro tiddler  named fubar but could be
> whatever, not especially macros (altgough very likely macros). And when the
> macro has no sub macros, the naming convention shouuld be the same: do not
> complexify 100% for the 10%. This rules out a scheme like
> $:/user/foo/macros/fubar/fubar and $:/user/foo/macros/fubar/_sub4fubar
> which would otherwise answer the question (but being a very ugly beast).
>
> 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?
>
> --
> 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/fd8f1a78-196c-4508-837e-7c53580563e0n%40googlegroups.com
> 
> .
>

-- 
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/CAAV1gMBQ_q6-%3Dic2qZiN4nxAzY1s0nKeRdPxKnTtpBTuMEquhg%40mail.gmail.com.


[tw5] protected macros

2021-06-28 Thread Jean-Pierre Rivière
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.

same question if my macro tiddler has _myStuff macro and a non macro 
tiddler define a macro also called _myStuff and use it: which one would be 
called? That's a variation from the previous question.

I know I can have _mySuff macro into a separate non macro tiddler, and 
\import it within my macro tiddler. That way my macro tiddler is 100% 
functionaal and _myStuff is not exported but creating another tiddler is a 
problem in itself: it's yet another tiddler, it's not that a good idea 
because it's only there for a single tiddler, and I would need to have a 
name for it. It would complexify my naming convention which is already a 
lengthy paper... and I would have to decide which idea is the one I shall 
get. to be honest, my macro fubar for the foo matter is in 
$:/user/foo/macros/fubar. So where should _sub4fubar be ? 
$:/user/foo/macros/fubar/private would do but then $:/user/foo/macros/fubar 
would both be a file and a directory, whis is a no go. So no way to store 
anything below the macro name. $:/user/foo/privateMacros/fubar perhaps? 
or  $:/user/foo/private/macros/fubar ? I could have some macro for a bar 
filter in $:/user/foo/private/filters/fubar but then I don't have the same 
meaning for macros there than in the $:/user/foo/macros/fubar where 
"macros" tells that here are macros but in $:/user/foo/private/macros/fubar 
"macros" tells that this concerns a macro tiddler  named fubar but could be 
whatever, not especially macros (altgough very likely macros). And when the 
macro has no sub macros, the naming convention shouuld be the same: do not 
complexify 100% for the 10%. This rules out a scheme like 
$:/user/foo/macros/fubar/fubar and $:/user/foo/macros/fubar/_sub4fubar 
which would otherwise answer the question (but being a very ugly beast).

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?

-- 
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/fd8f1a78-196c-4508-837e-7c53580563e0n%40googlegroups.com.