In literature on logic and set theory, there seem to be two different definitions of functions, one more general than the other. First of all, a function $f\colon X\to Y$ consists of three element $(X, Y, f)$, where $f\subseteq X\times Y$ satisfies $$\forall x\in X\quad\exists!y\in Y:(x,y)\in f. $$
On the other hand, a wff $P(x,y)$ with free variables $x,y$ gives rise to a function $x\mapsto y$ if $$ \forall x\quad\exists!y:P(x,y). $$ (Of course, $P$ could have other free variables, but I don't notate them.) The last definition, which allows our functions to be defined on our entire universe of sets, is the one used, for instance, in the Axiom Schema of Replacement. In many cases, I also see that people use the notation $y = f(x)$ even though $f$ cannot be defined as an object in our set universe.
I think that, even though we can always guess from the context which definition we use, the two definitions have a significant difference, first of all in their general applicability. My question is: Do I understand everything correctly? And in this case, is there no terminology to distinguish between functions in the two senses described? Isn't it somewhat sloppy to use the same terminology? Would it be totally wrong to call the first one a function and the second one a map, for instance?