What exactly is a function? This remark appears in Terence Tao's Analysis I

Remark 3.3.6. Strictly speaking, functions are not sets, and sets are not functions; it does not make sense to ask whether an object $x$ is an element of a function $f$, and it does not make sense to apply a set $A$ to an input $x$ to create an output $A(x)$. On the other hand, it is possible to start with a function $f : X → Y$ and construct its graph $\{ (x, f(x)) : x \in X \}$ , which describes the function completely: see Section 3.5.

In a lot of books I checked (almost all of them about Set Theory) do consider $f$ to be a set defined as $f = \{ (x, f(x)) : x \in X \}$ which is included in $X \times Y$ (i.e The Cartesian product of $X$ and $Y$) and I don't see why Tao sees it as nonsensical?
One other thing, lets consider this two definitions:
(1) For each element $x \in A$, there exist at most an element $y$ in $B$ such that $(x,y) \in f$, $y = f(x)$, or $x f y$ depends on the notation used.
(2) For each element $x$ in $A$, there exist a unique element $y \in B$ such that $(x,y) \in f$, $y = f(x)$, or $x f y$ depends on the notation used.
In almost all French books I checked (1) is a definition of a they call "fonction" (i.e Function in English apparently), and (2) is for what they call "application" (I don't know what it should be translated to in English, I think 'map' would do), but in English books I checked they don't make this distinction, they define function, map...etc as in (2) and consider (1) to a not be a function.
My question is which one I should consider as a the definition for a function? even though (2) would make the most sense for me, because why would you include elements that not have an image in the domain of $f$? 

I like and suggest the following definition:
A function $f:A\to B$ is a triple


*

*a first set $A$ (domain)

*a second set $B$ (codomain)

*a law (i.e. a rule, a relationship, etc.) such that at each element of $A$ is associated one and only one element of $B$ that is 
$$\forall x\in A \quad \exists ! y\in B:\,y=f(x)$$
