Dollar sign ($) in widget attributes?

63 views
Skip to first unread message

amreus

unread,
Sep 27, 2020, 1:06:12 PM9/27/20
to TiddlyWiki

I see some widget's attributes start with a $ and some don't.  Does the $ have special meaning?





amreus

unread,
Sep 27, 2020, 1:20:53 PM9/27/20
to TiddlyWiki
On further inspection, is it the action widgets and the macrocall widget which use the $attribute.  The rest do not.  That's easier to remember.


TW Tones

unread,
Sep 29, 2020, 8:52:20 PM9/29/20
to TiddlyWiki
Amreus,

Often overlooked by people is the logical necessity of a prefix on some parameters, once you understand this you may find yourself identifying when the $ is likely to be used, rather than any need commit it to memory.
  • In the case of the macrocall widget, what If I wanted to pass a parameter called name, type or output ? they would be confused with the widgets parameters, 
    • so $name, $type and $output ensure the widgets own parameters stay out of the way.
  • And you can also imagine when creating new tiddlers or fields the $ is often used for the same reason, so as to not limit the names of parameters that can be use.
    • The new tiddler and set field and in fact all Action widgets must use $ for the very same reason.
As an experienced programmer I have learned there are good reason for a lot of things people perceive as exceptions or complexity, to actually be logical necessities. 
  • You can see in this case the ability to have a prefixed parameter "$name" is essential in some widgets. 
  • Unfortunately most documentation, for most systems, including programming languages, do not explain these logical necessities.
    • An example is the the mathematical order of precedence in programming languages 4x(3x2+5), many languages document them as if they invented this
    • however they were developed hundreds of years earlier in the field of mathematics
    • By not recognising this history, people are forced to remember every detail "again", rather than rely on it mapping to historical standards.
Regards
Tones
Reply all
Reply to author
Forward
0 new messages