Very good discussion!

Having some good practice helps improve readability of the Tiddlywiki
scripts! One problem I always have is reading codes especially those with
several tiddlers and I found it quite difficult to follow!

@Mario

- semantic names as you suggested are very helpful
- the prefix like tv- for variable! It would be great to distinguish here
between different type of vars
- global and local vars and scope is also one area of confusion! a global
var in a tiddler scope is one defined using \define
  and out of scope is the one is defined using \define in a tiddler tagged
with $:/tags/Macro
- overloading macros and variable is a great feature of Tiddlywiki worth
more discussion

Maybe we could benefit of documents on Javascript, as I believe TW Scripts
is high level language comparing to JavaScripts
I try to get idea from W3C JavaScripts best practice:
https://www.w3.org/wiki/JavaScript_best_practices



Best wishes
Mohammad


On Wed, May 5, 2021 at 10:35 PM PMario <[email protected]> wrote:

> On Wednesday, May 5, 2021 at 4:53:25 PM UTC+2 Atronoush wrote:
>
>> I have followed recent discussion on naming the fields or tiddlers in the
>> Google Forum! I wish to know are there recommendations for this?
>>
>>    - variable name
>>       - by $set
>>       - by $vars
>>       - by $list
>>       - by $wikify
>>
>>
> Good question. ... The universal answer. ... It depends ;)
>
> I think the most important thing is, that you use _good_ names, that
> explain "*what they do*" or "*what they contain*"
>
> What I use for variables:  config-title, config-filter
>
> eg:
>
> \define getConfigTitle() $:/temp/$(currentTiddler)$
>
> \define config-filter() [tag[config]]
>
> <$list filter=<<config-filter>> >
>   <$macrocall $name="a-macro" title=<<getConfigTitle>> />
>   <<currentTiddler>> -> <<getConfigTitle>>
> </$list>
>
> If a tiddler title is dynamic and I need to build it with at macro I use
> getConfigTitle() for the macro. So I know, whenever there is a
> getSomething() there will be variable substitution involved
> <https://tiddlywiki.com/#Macros%20in%20WikiText:%5B%5BMacros%20in%20WikiText%5D%5D%20%5B%5BMacro%20Definitions%20in%20WikiText%5D%5D>.
> ...
>
> For other variables I prefer lowercase-lowercase-lowercase  to increase
> readability and I don't have to think about "case".
>
> But as I wrote: The most important thing is "good names" ... which is the
> difficult part ;)
>
> 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/8f429e9b-cb56-45b3-bfff-d192f091f904n%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/8f429e9b-cb56-45b3-bfff-d192f091f904n%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/CAAV1gMAvnhcP-8YvsJv2pH%2BeokY%3DJYP8gxo-6h0tWtK5EDoVDQ%40mail.gmail.com.

Reply via email to