In the book "Analysis I", Terence Tao provides the following definition:
Let $X$ be a subset of $\textbf{R}$, let $f:X\to\textbf{R}$ be a function, let $E$ be a subset of $X$, $x_{0}$ be an adherent point of $E$, and let $L$ be a real number. We say that $f$ converges to $L$ at $x_{0}$ in $E$, and write $\lim_{x\to x_{0};x\in E}f(x) = L$, iff for every $\varepsilon > 0$, there corresponds a $\delta > 0$ such that for every $x\in E$ one has that \begin{align*} |x - x_{0}| < \delta \Rightarrow |f(x) - L| < \varepsilon \end{align*}
Similarly, in the book ''Analysis II'' the same author provides the following definition:
Let $(X,d_{X})$ and $(Y,d_{Y})$ be metric spaces, let $E$ be a subset of $X$, and let $f:X\to Y$ be a function. If $x_{0}\in X$ is an adherent point of $E$, and $L\in Y$, we say that $f(x)$ converges to $L$ in $Y$ as $x$ converges to $x_{0}$ in $E$, or write $\lim_{x\to x_{0};x\in E}f(x) = L$, if for every $\varepsilon > 0$ there exists $\delta > 0$ such that $d_{Y}(f(x),L) < \varepsilon$ for all $x\in E$ such that $d_{X}(x,x_{0}) < \delta$.
My question about these definitions is the following: what is the role of the set $E$?
As far as I have understood, the set $E$ tells us how we are approaching $x_{0}$.
Let us consider an example.
Let $X = \textbf{R}\backslash\{0\}\subseteq\textbf{R}$ and $f:X\to\textbf{R}$ be given by $f(x) = x/|x|$. Thus if we consider $E = (0,\infty)$, $x_{0} = 0\in\textbf{R}$ is an adherent point of $E$. Hence we have that \begin{align*} \lim_{x\to x_{0};x\in E}f(x) = \lim_{x\to 0;x\in(0,\infty)}\frac{x}{|x|} = \lim_{x\to 0;x\in(0,\infty)} 1 = 1 \end{align*}
Similarly, if we choose $E = (-\infty,0)$, $x_{0} = 0\in\textbf{R}$ is an adherent point of $E$. Thus it results that \begin{align*} \lim_{x\to x_{0};x\in E}f(x) = \lim_{x\to 0;x\in (-\infty,0)}\frac{x}{|x|} = \lim_{x\to 0;x\in(-\infty,0)} -1 = -1 \end{align*}
At last, if we choose $E = X$, the limit $\lim_{x\to 0;x\in E}f(x)$ is undefined.
But I am little bit unsure about this. From the context, I assume that we are immersed in the metric space $(\textbf{R},|\cdot|)\supseteq X\supseteq E$.
Here it is another example which may be enlightening.
Let $f:X\to\textbf{R}$, where $X = \textbf{R}\backslash\{1\}\subseteq\textbf{R}$, which is defined by \begin{align*} f(x) = \frac{x^{2} - 1}{|x-1|} \end{align*}
If we choose $E = (1,+\infty)$, then $1$ is an adherent point of $E$. Thus we have that \begin{align*} \lim_{x\to 1;x\in E}f(x) = \lim_{x\to 1;x\in (1,+\infty)}\frac{x^{2}-1}{|x-1|} = \lim_{x\to 1;x\in (1,+\infty)}\frac{x^{2}-1}{x-1} = \lim_{x\to 1;x\in (1,+\infty)} x+1 = 2 \end{align*}
Similarly, if we choose $E = (-\infty,1)$, $1$ stills a adherent point of $E$. Thus we have
\begin{align*} \lim_{x\to 1;x\in E}f(x) = \lim_{x\to 1;x\in (-\infty,1)}\frac{x^{2}-1}{|x-1|} = \lim_{x\to 1;x\in (-\infty,1)}-\frac{x^{2}-1}{x-1} = \lim_{x\to 1;x\in (-\infty,1)} -x-1 = -2 \end{align*}
Finally, if we choose $E = X = \textbf{R}\backslash\{1\}$, the limit $\lim_{x\to 1;x\in E}f(x)$ is not defined.
The same reasoning seems to apply to more general settings where we consider metric spaces other than the real line.
Am I interpreting it correctly? If not, how should I grasp this concept?
I am new to this. So any comment or contribution is appreciated.
EDIT
Here it is another example from the textbook which may help us understand it properly.
Consider $f:\textbf{R}\to\textbf{R}$ to be the function defined by setting $f(x) = 1$ when $x = 0$ and $f(x) = 0$ when $x\neq 0$. Thus if we choose $E = \textbf{R}\backslash\{0\}$ one has that $\lim_{x\to 0;x\in E}f(x) = 0$. On the other hand, if $E = \textbf{R}$, the limit $\lim_{x\to 0;x\in E}f(x)$ is not defined.
After this example, he provides the following argument:
Some authors only define the limit $\lim_{x\to x_{0};x\in E}f(x)$ when $E$ does not contain $x_{0}$ (so that $x_{0}$ is now a limit point of $E$ rather than an adherent point), or would use $\lim_{x\to x_{0};x\in E}f(x)$ to denote what we would call $\lim_{x\in x_{0};x\in E\backslash\{x_{0}\}}f(x)$, but we have chosen a slightly more general notation, which allows the possibility that $E$ contains $x_{0}$.
Your understanding seems fine. The usual definition of the limit has to do with the behavior of the function at points near $x_0$. This more elaborate definition allows one to restrict one's attention to those points that are not only near $x_0$ but also in $E$, which is useful in some situations. Sometimes people word this as "the limit of $f(x)$ as $x \to x_0$ through $E$", or "... along $E$".
You've already given one example: if $X$ is a subset of $\mathbb{R}$, and $E = (x_0, +\infty) \cap X$, then this definition recovers the usual notion of "limit from the right".
Another example that sometimes arises is when we have proved something about the behavior of $f$ on, say, a countable dense subset $E$ of $X$ (of which every point will be an adherent point). We might not have enough knowledge about the overall behavior of $f$ to be able to say anything about the ordinary limit of $f(x)$ as $x \to x_0$, but we may be able to say something about the limit as $x \to x_0$ through $E$.