Tags:
create new tag
view all tags

What do we call these things?

For what I presume are historical reasons, the built-in TWikiVariables are a combination of variables and functions. (I distinguish between the two because I'm unaware of any use of the term variable that includes parameters.) Internally, all of these are called tags, with a hash named functionTags holding the mapping between tag and the function that returns the replacement text, and a Twiki::Func call registerTagHandler to either override or add new tags (or variables or whatever they should be called).

This is not a mere terminology discussion for a number of reasons:

  • Users can create true variables via the Set mechanism, which will override anything else with the same name
  • Peter implemented a "Tagging" plugin which overloaded the word tag. I don't know if this has escaped into the wild, nor how wildly the term "tagging" in this sense has spread. (I won't comment on Peter introducing this with no discussion beyond this sentence.)
  • I've successfully implemented a mechanism that allows people to create their own tags/variables/whatever. The mechanism isn't very different from what's currently in place via writing a plugin, but it avoids the overhead of checking for handlers, which has been an ongoing concern. Before it's deployed (assuming TPTB allow it to be), what to call them matters. My current implementation calls them tags -- as this does not carry the bizarreness of variables having parameters -- but obviously I can (somewhat painfully) change it to something else.

-- Contributors: MeredithLesly

AreVariablesReallyDirectives

-- MartinCleaver - 05 Apr 2006

A ancient topic (2001!) that raises some of the same issues and was, like so many others, dropped. Goes to show that one can't assume ancient topics are cruft, although perhaps ancient topics should be folded in to more current ones.

-- MeredithLesly - 05 Apr 2006

It is always hard explain to a new TWiki user what the magic is behind "variables" as they are "macros" for Office users and LaTeX'ers, "functions" for programmers and mathematicians and "tags" for web programmers.

I often use macros - that is not the best choise but it applys without name clashes.

-- TobiasRoeser - 05 Apr 2006

Indeed. The one thing they are not, however, are variables by any reasonable (IMO) definition.

-- MeredithLesly - 05 Apr 2006

I share your views of the use of the word "variable", which is why I started to refer to them as tags (yes, sorry, it's my fault). I had a number of problems with users who could not perceive tags like SEARCH as "variables", and were very confused by the terminology. However by the time I got there, the terminology was already well embedded, so I backed down from the argument. FYI I used "tag" because of the existing meaning of the word in HTML. Macro is actually more accurate. But the bottom line is that you will not be able to change Peter's mind on the use of the word "variable".

-- CrawfordCurrie - 05 Apr 2006

He is, so to speak, invariable on the issue.

-- MartinCleaver - 05 Apr 2006

Sigh. So what else is new.

-- MeredithLesly - 05 Apr 2006

smile Lets do some termstorming ( (c) by FJ wink ), why don't we call them TWikiKeywords (see Wikipedia:Keyword, our TWikiVariables match at least the first two meanings)?

-- FranzJosefSilli - 05 Apr 2006

Keywords: -1

Although you can find argument for it, it is not intuitive and I never saw it used in such a context.

-- TobiasRoeser - 05 Apr 2006

Borrowing from TemplateToolkit, one could call them "directives", though they aren't quite the same thing. But alas - they aren't quite the same thing as X?(HT)?ML tags, nor the same thing as TagMePlugin tags, and only very few of them qualify as "variables".

Hold on - a search just revealed that about five years ago a certain Martin Cleaver has suggested the term "directive" in AreVariablesReallyDirectives, without too much applause.

But TWiki in 2006 isn't the same thing as it was in 2001.

"Directive" could well be used as a generic term covering all of variables, macros, functions, and labels (for example %STARTINCLUDE%).

At least until someone writes DirectiveMePlugin, that is. ;->

-- HaraldJoerg - 05 Apr 2006

Hm Wikipedia:Directive doesn't ring a bell. The only directive I know is 'Prime Directive, what Prime Directive?' (famous quote by Captain Kirk). wink

-- FranzJosefSilli - 05 Apr 2006

A directive is something that contains some directives/briefings/statements - grrr, I can't say in English what I wanted to say -. Directive is more some kind of rule or policy than a thing you can use to get something diplayed or something happen. (I'm not sure if an English speaker understand only one single word of my thoughts)

I would like to vote for macro, but this is only matching these TWikiVariables that are actually functions like SEARCH, not the real variables. But how will you explain to a new user that you can set new makros with * Set = SOMEVAR which can be actually only real plain variables, but not functions?

-- TobiasRoeser - 05 Apr 2006

What's wrong with macro, and an array syntax:

   * Set MY_ARRAY{fu} = VariablesShouldBeMacros
   * Set MY_ARRAY{bar} = IsItTooLateNow
   * Set TWOD_ARRAY{hoo,ray} = HesNotGoingToBudge

-- MartinCleaver - 06 Apr 2006

Too late. Nothing to see here. Move along. wink

-- MeredithLesly - 06 Apr 2006

I like the array syntax, and macro of course.

-- TobiasRoeser - 06 Apr 2006

We have a syntax today which is %VARIABLE{parameter="value" otherparam="othervalue"}%. The proposed syntax will make things even more complex because then there are two different sets of syntax in different contexts. This is the interface for the normal user - not the admin or programmers. We have to watch out what we do. In my view this would be a step up Kenneth's Nerdometer

And I completely fail to see how tags and macroes should be any better names than the current. They are all equally bad because the syntax covers all 3 and more. But changing names means that the huge customer base has to learn something new for no real value gained for them. I would rather spend an hour of training time teaching them to be more advanced users than starting all over explaining that variables are now functions or tags or macros or superwords or twikities or whatever other name we could change them to.

The existing users have gotten used to the word TWikiVariables and new users will learn this word as easily as they would learn any of the other.

-- KennethLavrsen - 06 Apr 2006

Unless a compelling example is shown, I don't see the need to change the current user-defined variable syntax. So I'm tentatively with Kenneth on this one.

And, my, we've drifted. But that happess in any discussion meium. The question related to the drift is: should the drift be refactored to a new topic?

-- MeredithLesly - 06 Apr 2006

I don't think, we drifted, at least not completely. The problem is, that users can define simple variables but not complex one, but it is possible to override even complex (builtin) variables with * Set OVERRIDETHIS. So we have two things but just one name. TWikiVaribale is in general ok for me, but I still have the problem, that whenever I speak about TWikiVariables, I have to explain what kind I mean, the builtin or the other. Can we agree that we need some prefixes like "simple" and "complex" for TWikivariables.

To the array syntax mentioned above: I like the idea, that users can take advatage of simulating complex variables, there is no need for a new syntax, but the ability to define something like this

   * Set MYVAR{name="var1"} = varibale 1
   * set MYVAR{name="var2"} = varibale 1
or
   * MYVAR{ name="theName" }
      * Set MYVAR{} = variable $name
is rather cool.

Of course, you can simply define *Set MYWAR_ONE and * Set MYVAR_TWO. If this is really useful or rather a bit more confusing (to the user, read non-nerd wink ) has to be discussed. OK, this is drifted now, sorry.

-- TobiasRoeser - 06 Apr 2006

The problem is that virtually all of the so-alled TWikiVariables are functions, even the ones that don't take arguments. Some of them are, in essence, in-context variables, like WEB or TOPIC. The closest that a user can come to writing a "function" via Set is something like: * Set ORIGINALAUTHOR = %REVINFO{"$wikiusername" rev="1"}%

It would be much clearer if the TWikiVariables that didn't take arguments continued to be called that and the rest called something like TWikiFunctions. No matter what we call things, however, any user who Sets something that has the name of a TWikiVariable or the equivalent from a plugin or tag is going to create very interesting results.

And, yes, I'm drifting as well.

-- MeredithLesly - 06 Apr 2006

Edit | Attach | Watch | Print version | History: r20 < r19 < r18 < r17 < r16 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r20 - 2006-04-06 - MeredithLesly
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.