Page MenuHomePhabricator

distinguish limited recursion (n times only) from infinite recursion
Closed, InvalidPublic

Description

Author: gangleri

Description:
Hallo!

[[meta:Help:Template#Repetition within a page]] describes how to handle
repetitive inclusions of the same template by making *n* copies of it.

I would say this is not according to the [[kiss]] principle and "newbies" would
probably not understand templates as [[meta:Template:List of template calls]]
especially because the parameters are *not* named.

feature request:

a) The template syntax should support a parameter as "SELFINCLUSIONS|<template
or page name>|<counter>" and "SELFINCLUSIONS|<template or page
name_1>|<counter>|SELFINCLUSIONS|<template or page
name_2>|<counter>|SELFINCLUSIONS|<template or page name_n>|<counter>" either at
the beginning or at the end of the parameter list.

b) It should be possible to limit the SELFINCLUSIONS numbers by a new variable
defined in DefaultSettings LocalSettings (see [[meta:Help:Configuration settings
index]], [[meta:Global variables]] etc.).

Best regards Reinhardt [[user:gangleri]]


Version: 1.5.x
Severity: enhancement
URL: http://meta.wikimedia.org/wiki/Help:Template#Repetition_within_a_page

Details

Reference
bz2897

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:40 PM
bzimport set Reference to bz2897.
bzimport added a subscriber: Unknown Object (MLST).

I don't understand how the referenced page has anything to do with the request or summary on this bug.

The referenced page describes how to use a template multiple times with different parameters. (By...
using it multiple times, with different parameters.)

This summary seems to be requesting some change about recursion detection, but I'm not sure why or
for what purpose. Currently multiple includes and recursive includes are *not* treated the same; recursive
cycles in the inclusion graph are detected and halted. This is not related in any way to multiple side-by-
side inclusions.

I'm closing this bug report as INVALID.

If you reopen, please provide a detailed and complete description of:

  1. What are you trying to accomplish?
  1. What is the exact example you tried to use? (Wikitext source.)
  1. What did you expect to happen, exactly?
  1. What actually happened?
  1. How do they differ?
  1. What do you want to happen differently?

gangleri wrote:

in response to comment 1

Thanks Brion for your feedback.
http://test.leuksman.com/index.php/User:Gangleri/tests/T/bugzilla:02897 provides
an example where Template:T006 is supposed to be called 4 times only. This is
*not* "infinite recursion" but what I called "repetitive template inclusion" in
the summary.

The page refered above and
http://test.leuksman.com/index.php/User:Gangleri/tests/T is a start of a
wikibook about special algebraic properties of "Jain squares" (order 4), their
coherence to Jain toughts about the world / universe and patterns about
equilibrium, transformations etc.

Because the involved templates at
http://test.leuksman.com/index.php/User:Gangleri/tests/T/bugzilla:02897 are
"called" in "trace mode" you can see that Template:T006 is substituted exatly
one time and substitution is stopped at the second recursion.

What I wanted to show in the example is that T006^4=T001. By the way:
T006^2=T011 (the "complementary" of T000) and T006^3=T016. These are some
"simple" examples. The book might use some X(Y(X^n(x))).

[[meta:Help:Template#Repetition_within_a_page]] suggests to create "copies" of
the original template. *But*: There would be 384 templates already. Adding up to
"n" copies of each does not make life easier.

At this point we need to think about what MediaWiki is and what it is not and
what are the consequences. MediaWiki is *not* a programming language. To some
extend some programming is possible. Nevertheless it can be used as a
"substitute" of a programming language (for some specific tasks) with
"questionable" performance when complexity is increased. I used "questionable"
because I have no clue about performance, about how many resources are used etc.

About the original URL [[meta:Help:Template#Repetition_within_a_page]],
[[meta:Template:List_of_Languages]] or the other examples refred there. I assume
that the construct "List of Languages" is equivalent to a "repetitive template
inclusion" or could be handeled in similar fashion. I mean "execution of some
code for the items of a specified list one by one".

Your questions:

  1. What are you trying to accomplish?

: To my understanding detection of "selfinclusion" is hardcoded. As the writer
of the code I would know that Template:T006 will be called four times (on a
distinct substitution path) in Template:T .
: a) What I was suggesting (I agree without specifying the details)
{{T/A|A=|B=|C=|TRANSITION1=006|TRANSITION2=006|TRANSITION3=006|TRANSITION4=006|TRANSITION5=/|TRANSITION6=/|TRANSITION7=/|TRANSITION8=/|OVERWRITEA=|OVERWRITEB=|OVERWRITEC=|TABLE=|BACKGROUND=#efefef|COLOR=black|ALIGN=left|WIDTH=20px|HEADER=T006(values
1 to 16)|NOTE=|LINKS=→ |TRACE=y}}
should be somthing like
{{T/A|*SELFINCLUSIONS|Template:T006|4*|A=|B=|C=|TRANSITION1=006|TRANSITION2=006|TRANSITION3=006|TRANSITION4=006|TRANSITION5=/|TRANSITION6=/|TRANSITION7=/|TRANSITION8=/|OVERWRITEA=|OVERWRITEB=|OVERWRITEC=|TABLE=|BACKGROUND=#efefef|COLOR=black|ALIGN=left|WIDTH=20px|HEADER=T006(values
1 to 16)|NOTE=|LINKS=→ |TRACE=y}}
or **SELFINCLUSIONS:Template:T006:4* or whatever is necessary to specify that 4
substitutions of Template:T006 are *legal repetitive template inclusion* and
should not be interpreted as "infinite recursion" where substitution would stop.
: b) "It should be possible to limit the SELFINCLUSIONS numbers by a new
variable defined in DefaultSettings LocalSettings" is a requirement against
vandalism and DoS, against *SELFINCLUSIONS|Template:foo|65.535*. This new
variable set to "2" for an arbitrary wiki would offer same "security" as
implemented now.

  1. What is the exact example you tried to use? (Wikitext source.)

see above
where "transitions of transitions" are defined as iterative actions *and*
further transitions as
{{T{{{TRANSITION1}}}|TRANSITION1={{{TRANSITION2}}}|TRANSITION2={{{TRANSITION3}}}|TRANSITION3={{{TRANSITION4}}}|TRANSITION4={{{TRANSITION5}}}|TRANSITION5={{{TRANSITION6}}}|TRANSITION6={{{TRANSITION7}}}|TRANSITION7={{{TRANSITION8}}}|TRANSITION8=/|...}}
and */* being the "stop" condition

  1. What did you expect to happen, exactly?

described above
have control of the "stop substitution mechanism" *on a case by case basis*

  1. What actually happened?

the "stop substitution mechanism" stops at the second substitution of the same
inclusion

  1. How do they differ?

the actual code stops before generating the intended square; the required would not

  1. What do you want to happen differently?

Dear Brion, dear developers. The requested enhancement does not mean some
personal benefit for me. I hope to be able use the known workarounds or to find
new ones. The main question is if it would bring an enhancement *for the
comunity* or not, if it would make life easier or not, if it would simlify
things *without* adding security relevant issues.

Best regards Reinhardt [[user:gangleri]]

angus wrote:

(In reply to comment #3)

Can anyone understand this?

Yes... he wants a way to tell the software how many times the template can be
expanded without being infinite recursion.

For example, if you have a template named T(A) with the following contents:

{{T({{{next 1}}})|next 1={{{next 2}}}|next 2=stop}} x

when you write {{T(A)|next 1=A|next 2=A}}, it should be expanded to:

first: {{T(A)|next 1=A|next 2=stop}} x
then: {{T(A)|next 1=stop|next 2=stop}} x x
lastly:{{T(stop)|next 1=stop|next 2=stop}} x x x

(and then comes the expansion of {{T(stop)}}). So, he wants to let the software
know that expanding T(A) three times in a row isn't infinite recursion. (Too
complicated, IMHO.)