[pmwiki-devel] {~varname} vs. {~$:varname} in ZAP

Patrick R. Michaud pmichaud at pobox.com
Thu Jun 14 10:56:17 CDT 2007


On Thu, Jun 14, 2007 at 09:44:46AM -0500, Ben Stallings wrote:
> At Dan's request, I'm bringing a disagreement he and I have had by 
> private email to the list for other folks' feedback.
> 
> In the most recent version of ZAP, he has provided the new markup
>   {~Author$:varname}
> which retrieves the varname page text variable from Author's Profiles 
> page.  

Nice.  Works for me.

> However, he's also provided a further shortcut for retrieving the 
> current user's data (i.e. {~{AuthId}$:varname} ).  His markup is
>   {~varname}
> I feel strongly that this should be
>   {~$:varname}
> instead, so that it's comparable to {*$:varname} and {=$:varname}.  

Consistency -- generally a very good thing -- would tend to argue in 
favor of {~$:varname}.    This also matches the Unix standard where
~Alice refers to Alice's home directory, and ~ by itself refers to the
home directory of the currently logged in user.

In fact, ignoring {~varname} for a moment:  If {~Alice$var}
works to get a page variable from Alice's profile page, then
I would naturally expect that {~$var} would get a page variable
from the current author's profile page.  To me, if that doesn't work,
it violates the principle of least surprise.

So, I think that {~$var} should work in any case, and the question
is whether {~varname} is a useful shortcut, and if so, what should
it be a shortcut to.

One argument against {~varname} is that it appears to be a shortcut
only for page text variables, not page variables.  So, {~varname}
allows me to get to $:varname inside of a profile page, but there's 
no real shortcut to $varname for a profile page.

Beyond that, there's some real potential visual confusion in that
{~Alice} _looks_ like it's somehow talking about Alice's profile 
page, but as defined above it's really the $:Alice page text 
variable of the current user.  That's a little confusing.

Anyway, I'd tend to always go with {~$:var} for consistency.
I think it'd be okay to offer {~var} as a shortcut, but I think
there's potential for confusion there, and saving two characters
per variable just isn't worth that level of confusion to me.

My $0.02,

Pm



More information about the pmwiki-devel mailing list