Von Neumann's original axioms of what became von Neumann–Bernays–Gödel set theory took as primitive notions function and argument. Accompanying these was a two-variable operation, denoted $[x,y]$, corresponding to function application:
The operation $[x,y]$ corresponds to a procedure that is encountered everywhere in mathematics, namely, the formation, from a function $f$ (which must be carefully distinguished from its values $f(x)$!) and an argument $x$, of the value $f(x)$ of the function $f$ for the argument $x$. Instead of $f(x)$ we write $[f,x]$ to indicate that $f$, just like $x$, is to be regarded as a variable in this procedure. Through the use of $[x,y]$ we replace, as it were, all one-variable functions by a single two-variable function. In this scheme the elements of the domain of "functions" answer to the functions (conceived naively) that are defined for the "arguments" and whose values are "arguments".
[from von Neumann's 1925 article, An axiomatization of set theory, as translated into English in From Frege to Gödel: A Source Book in Mathematical Logic, 1879-1931, Harvard University Press, pp. 393–413]
I'm trying to understand how the $[f,x]$ operation handles the case where $x$ does not belong to the domain of $f$. I feel like this could arise in certain models of the theory, but in first-order logic, shouldn't an expression such as $[f,x]$ be valid to form for all function letters $f$ and argument letters $x$, since we can't determine whether or not $x$ is in the domain of $f$ without referring to an explicit model? Or, is the last line in the above quotation actually imposing a restriction on how we can use the operation?
I read von Neumann like this: his functions are intended to be total on a universe of what he calls I-objects (i.e., things that intuitively can be arguments and values of functions). The I-objects correspond to sets as opposed to classes in the usual presentation of NBG. Classes correspond to his II-objects and the II-objects include the I-objects. If $x$ is not an I-object, then $[a, x]$ isn't really meaningful and the axioms say nothing about its value. He selects two arbitrary I-objects $A$ and $B$, which are used to represent false and true when a function represents a set. $A$ is also used to act as the "default" value for a function. So a function $f : X \to Y$ in NBG would be represented by two I-objects $f_d$ and $f_v$ representing the domain of $f$ and the values of $f$ separately, thus:
$$ \begin{align*} [f_d, x] &= \left\{ \begin{array}{l@{\quad}l} A &\mbox{if $x \not\in X$} \\ B & \mbox{if $x \in X$} \end{array}\right. \\ [f_v, x] &= \left\{ \begin{array}{l@{\quad}l} A &\mbox{if $x \not\in X$} \\ f(x) & \mbox{if $x \in X$} \end{array}\right. \end{align*} $$
This reading is based on von Neumann's axiom IV.2 and his earlier discussion about it. That axiom asserts that a II-object $a$ is not an I-object if the I-objects $x$ such that $[a, x] \neq A$ comprise a proper class and not a set.