Notation for a statistic, or function of a random variable A statistic is a function of random variables, so it is also a random variable. Suppose we have a collection $X = (X_1, X_2, \dots, X_n)$, where $X:\Omega \to \mathcal{X}^n$. There are two common notations for a statistic:
$$
S = r(X_1,X_2, \dots, X_n)
$$
where $r: \mathcal{X}^n \to \mathbb{R}$. In this context, the definition of the function $S$ is clear as the composition of the functions $r$ and $X$, and the definition $S: \Omega \to \mathcal{S}$ arises naturally where $S(\omega) = r(X_1(\omega), \dots, X_n(\omega))$.
However an alternative notation seen quite often is 
$$
S(X_1,X_2, \dots, X_n)
$$
What is the formal interpretation of this notation? For instance, what is $S(X_1,X_2, \dots, X_n)(\omega)$? What is the mathematical object $S$?
 A: There is a certain ambiguity here.  In one context, as when one writes $S(X_1,\ldots,X_n)$, one regards $S$ as simply a function of $n$ variables,
$$S:\mathcal X^n \to \mathbb R, \tag 0$$
but in another context, as when one inquires about the probability distribution of $S$, one regards it as a function whose domain is $\Omega$, thus
\begin{align}
S : \Omega & \to \mathbb R \tag 1 \\[6pt]
\omega & \mapsto S(X_1(\omega),\ldots,X_n(\omega)) \tag 2
\end{align}
where the $S$ in line $(2)$ is, perhaps confusingly, the same thing as the one in line $(0)$ and different from the one in line $(1)$.
It's the same thing as when, in calculus, one writes, for example
\begin{align}
y & = u^{20}, \\[8pt]
u & = x^3 - 5x + 9, \\[8pt]
y & = (x^3 - 5x +9)^{20}
\end{align}
should one say $y$ is a function of $u$, or that it is a function of $x$?  Certainly those are two different functions?  But one says instead that $y$ is a "variable", as are $u$ and $x$, and there are certain functions that tell you the value of one variable given one of the others.  It does seem as if the logic concerning this situation is not as well developed as are most things in mathematical reasoning.
