TW Fundamentals: the now system identifier: a use case

The now identifier is a "system" identifier (i.e. it is a "built-in" TiddlyWiki feature.)

When a now transclusion reference (with "<<now>>" when transcluded in the body of a tiddler, or with "<now>" when transcluded in a filter) the transclusion reference is replaced with the current date and time in whatever format if is specified as part of the transclusion.

Example transclusion of now with a date/time format (this is a parameterized transclusion):
  <<now "YYYY-0MM-0DD 0hh:0mm:0ss">>

Here's a small code sample for study, demonstrating a use case for "now":


And the code for you to try in a TiddlyWiki instance:

<$button>

<$action-createtiddler
   $basetitle={{{ [[Captain's Log ]] [<now "YYYY-0MM-0DD 0hh:0mm:0ss">] +[join[]] }}} tags="log" >
    <$action-sendmessage
             $message="tm-edit-tiddler"
             $param=<<createTiddler-title>>/>
</$action-createtiddler>

Create Captain's Log Entry

</$button>

TW Fundamentals: vars vs let

The difference in a "picture":


The code for copy-pasting into your TiddlyWiki instance:

<$vars msgP1="Hello"
       msgP2 = "World!"
       theMsg={{{ [<msgP1>] [<msgP2>] +[join[ ]] }}}>

Using the vars widget:

* msgP1: <<msgP1>>
* msgP2: <<msgP2>>
* theMsg: <<theMsg>>

</$vars>

<$let msgP1="Hello"
      msgP2 = "World!"
      theMsg={{{ [<msgP1>] [<msgP2>] +[join[ ]] }}}>

Using the let widget:

* msgP1: <<msgP1>>
* msgP2: <<msgP2>>
* theMsg: <<theMsg>>

</$let>

A textual explanation to follow ...

TiddlyWiki: my view of "<<...>>" , variables, and macros

I do not like the label "variables" for TiddlyWiki variables.

I also do not like the label "macros" for TiddlyWiki macros.

Now that I have yanked those words out of the picture, let me explain with my TiddlyWiki vocabulary the purpose of the "<<" and ">>" delimiters in the context of "<<...>>".

When something is wrapped in those delimiters, it tells TiddlyWiki to process the thing as a reference to a named value that has been previously defined, versus treating the thing as any regular text.

When that something is rendered (upon first display, or upon refresh via some trigger), or referenced in some action, the value reference (i.e. the "<<...>>") is replaced with the related value.

Really, <<...>> does the exact same thing as {{...}}:

Both <<...>> and {{...}} perform transclusions.

Both of these are references to some value (however big or small) and both of them get replaced by their related values.

Whereas "{{...}}" is for the transclusion of some value in some tiddler field, "<<...>>" is for the transclusion of some value that has been defined via a "widget" (some examples: set, vars, and let widgets) or a \define pragma.  Some example widgets: $set, $vars, $let.

When "<<...>>" has nothing else between the delimiters but an identifier (i.e. the name related to a value), we have a simple transclusion of the related value.

When "<<...>>" has more than just an identifier between the delimiters (i.e. the identifier is followed by space-separated words we call "parameters", we have a parameterized transclusion.  Parts of the value  related to the identifier will be substituted with the values of the parameters.

So that's how I view "<<...>>", and that's the vocabulary I use related to that transclusion.



One of my favourite agile principles: travel light

Reference: Agile Modeling Principle - Travel Light 


Simply, I carry it (whatever "it" is) only if it hurts too much not to carry it.


I generally and liberally apply this principle to pretty much all things, including things that increase sensory and/or cognitive overload without being worth the cost.