"Steve Bennett" <stevagewp(a)gmail.com> wrote in
message news:b8ceeef70711161637g3d660294o6ba60df237a64e83@mail.gmail.com...
On 11/17/07, Mark Clements
<gmane(a)kennel17.co.uk>
wrote:
There are magic words that are directives to the parser, e.g. __NOTOC__
and there are magic words that are variables to be expanded, e.g.
{{PAGENAME}}. I don't necessarily consider it a problem
to have the two forms, so long as the syntax is unambiguous
(i.e. wrap in __ for parser directives, {{ }} for variables).
I am not sure if this is currently the case or not.
The ambiguity arises from using a single word to describe both kinds of
item. It is confusing to use a single word to refer to two distinct
concepts, and this is not helped by describing them as 'magic words', a
name which only serves to make them seem even more mysterious.
It would be better if they were referred to as 'parser directives' and
'built-in variables' respectively, and not grouped together under the
single term. If it were upto me, I'd lose the term 'magic word'
altogether.
I think the code generally refers to the second type as "magic
variables".
In your next email you suggest that __TOC__ is effectively a magic
variable, but it's really not: it's not immediately substituted by
something else.
Actually, no. Thomas Dalton replied to my e-mail saying that __TOC__ was
actually a variable, but in my reply I stated (for the same reasons you
give) that it is a parser directive.
[SNIP]
Anyway, if all magic words look like __x__ and all
magic variables look
like {{x}} then I'm very happy. If all magic words/variables look like
__x__ or {{x}} without any particular distinction, that I'm still happy.
Other alternatives are...scarier.
I think it's very important to drop the use of the word 'magic' in
describing these types of things. There is nothing magic about syntax-based
substitution. 'Magic' words in MediaWiki are "ISBN", "RFC",
unquoted URLs,
etc. These are plain-text elements that are automatically turned into
links, whether the user wanted that or not, and which do not require any
extra syntax. The special tokens that are surrounded by two underscores are
'parser directives' and the special tokens that are reserved words
surrounded by double curly braces are 'built-in variables'. There is
nothing magic about them (unless we also want to call text surrounded by two
square brackets 'magic links' and lines with equals signs at each end 'magic
headers').
- Mark Clements (HappyDog)