My textbook gives the definition of the limit of a function at a point as below: $$(\forall \epsilon>0)(\exists \delta>0)(\forall x\in \mathbb{R}), 0<|x-a|<\delta \implies |f(x)-L|<\epsilon$$
I know we need $\forall x\in\mathbb{R}$ instead of $\forall x\in \text{Dom}(f)$, since the latter would cause the implication to be vacuously true if $a$ is a point which has a neighborhood such that $f$ is undefined for every point in this neighborhood. For example a function like $f_{1}:\{ 0 \}\to \mathbb{R}$ defined by $f_{1}(0)=1$ would pose a problem, since according to our intuition of what a limit "should be", this function should not have a limit at $0$, but if we use the quantifier $\forall x\in \text{Dom}(f)$, then it does in this case.
So we must have $\forall x\in\mathbb{R}$ instead. But then what do we do if the function "approaches" $L$ as $x\to a$, but $f$ always has undefined values in any sufficiently small neighborhood of $a$? That is, how do we interpret the truth value of $|f(x)-L|<\epsilon$ in the implication when $f(x)$ is undefined?
Do we want the truth value of $|f(x)-L|<\epsilon$ to be true when $f(x)$ is undefined? Then we have a problem because, for the function $f_{1}:\{ 0 \}\to \mathbb{R}$ defined by $f_{1}(0)=1$, the limit of this function at the point $a=0$ is equal to any number, since the conclusion of the implication is true trivially for any epsilon (just take delta to be any positive number, so the function is undefined for all value in the delta-neighborhood of $a$).
Do we want the truth value of $|f(x)-L|<\epsilon$ to be false when $f(x)$ is undefined? Then what about functions where the function "gets close to $L$ as $x$ gets close to $a$", but $f$ always has undefined values in any neighborhood of $a$? For example, the function $f_{2}:\mathbb{R}\setminus\mathbb{Q}\to \mathbb{R}$, defined by $f_{2}(x)=x$, where $a=0$. If the truth value of $|f_{2}(x)-0|<\epsilon$ is false for values of $x$ for which the function $f_{2}$ is undefined, then the implication is false, and so the limit does not exist, since there will always be rational values of $x$ in any delta-neighborhood of $0$. Is the solution really just to say that such a function does not have a limit at $0$, even though "it gets close to $0$ for values of $x$ near $0$"?
The only way I can come up with to fix this issue is to say that the above definition for limits is ONLY for functions of the form $f:A\to \mathbb{R}$, where $A$ is a subset of $\mathbb{R}$ such that no point in $A$ has a neighborhood that has infinitely many points not in $A$.
I would greatly if someone could clear up this misunderstanding for me. I am very new to analysis and having a hard time trying to figure this part out.