Hi Tobias

Ok, so let's consider the hypothetical syntax fixed...
>
>>
> \define tagging(title)
> <$set name="tid" value="""$title$""" default="<<currentTiddler>>"/>
> <$list filter="[[<<tid>>]tagging[]]"/>
> \end
>
> The trouble is that in many situations an empty string is a valid value
>> that shouldn't be defaulted; what we really want here is a way to detect
>> missing parameters.
>>
>
> How and when are variables evaluated? Could the evaluation return some
> *<<undefined>>* or *<<null>>* value subsequently passed to the set widget
> in order to trigger using a default fallback?
>

The trouble is that the macro parameter is inserted into the macro body
using textual substitution. Thus if you don't pass the title parameter then
the first line of the macro body will be:

<$set name="tid" value="""""" default="<<currentTiddler>>"/>

So, there's an empty string being passed as the attribute "value". There's
no way for the set widget to distinguish that empty string as a missing
value that needs to be defaulted unless it regarded all empty strings as
missing values. The trouble with that is that often we want to be able to
assign an empty string to a variable. That could be accomplished by
assigning the empty string as expected if the "default" attribute is
missing.

I think it's less complicated to fix the issue by introducing transcluded
default values for macro definitions.

Best wishes

Jeremy.



>
> Best wishes, Tobias.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to