I think this
and current
really derive from conditions that can arise with (more complex) HTML scenarios than with action code per se. In most cases the default locus of an action code is this
so doesn’t need to be explicitly stated. In simplest form, these are the same:
$MyString=$Name;
$MyString=$Name(this);
$MyString=$Name();
If the note is called “ABC”, in all three cases $MyString would be set to “ABC”
The referenced article on that
states:
For instance, it makes it possible to to use an attribute value from the calling notes within a find() query in an expression. In such contexts, ‘this’ would apply to the note being queried by find() rather than the note calling find().
The point being that within the scope of a query run via find()
in a query, the value is this
differs from normal. Perhaps we wish to find any “Event”-prototyped note where $MyString equals the $Name for the note running the find, e.g. in a rule, edict or stamp. We might write:
$MyList = find($Prototype="Event" & $MyString==$Name(this));
or as we know from above it is the same as this code
$MyList = find($Prototype="Event" & $MyString==$Name);
But, neither of these queries works as intuited as the second form shows more clearly. Why? Because within the find(), as each note with the “Event” prototype is tested this
becomes the note being tested, rather than the note running the find(). To make the query use the $name of the note running the find()
we use the that
designator.
I’ve just updated my aTbRef note to reflect better the description here, above. @eastgate may correct me, but at present I think find()
is the current place where the that designator is needed (at present!)