My Stewart's Calculus gives the following definition of limit:
$f(x)$ is defined on some open interval containing $a$, except at possibly $a$. So, $\lim_{x\to a} f(x) = L $ if and only if for every number $\varepsilon>0$, there exists a corresponding number $\delta>0$ such that, if $0<|x-a|<\delta$ then $|f(x)-L|<\varepsilon$.
I am not sure of the exact wordings of the above, but I am quite sure that its what meant it meant to say. However, my Introduction to Real Analysis: Bartle and Sherbert, gives:
Let $A \subseteq \mathbb{R}$, and let $a$ be a cluster point of $A$. For a function $f: A \mapsto \mathbb{R}$, a real number $L$ is said to be a limit of $f$ at $a$, if given any $\varepsilon>0$, there exists a $\delta>0$ such that if $x \in A$ and $0<|x-a|<\delta$, then $|f(x)-L|<\varepsilon$.
Now my problem is when considering, for example, if $f: A \mapsto \mathbb{R}$, where $A=\{ x: x \text{ is irrational} \}$, and $f(x)=0$. By Stewart's definition, $f$ can't be defined on any open interval around $0$, as there will always be a rational number in it. So it fails the first condition, and $\lim_{x\to 0} f(x)$ is not defined.
However, according to the definition of cluster point, there will always be one irrational $x$ that satisfies $0<|x-0|<\delta$ for every $\delta<0$. Hence $0$ would be a cluster point. Now, if $x\in A$, i.e. if $x$ is irrational and $0<|x|<\delta$ then obviously $0<\varepsilon$. So $\lim_{x\to 0} f(x)=0$.
What is going on?
I agree with the comments: Stewart's definition can be applied to fewer cases. In Calculus, the choice of simplification is very appealing, since the most general case might require tools that cannot be presented in a first course. The most common simlpification is indeed about the domain of definition of the functions: most calculus books deal with functions defined on intervals. Why? Because $(a,b)$ is the basic example of open set of the real line, and $[a,b]$ is the basic example of compact set of $\mathbb{R}$.
Consider the theorem of Weierstrass: it holds true for any continuous function defined on any compact subset of $\mathbb{R}$ (and of course also for general topological spaces). However, most calculus books state it for continuous functions defined on $[a,b]$. As you noticed yourself, these authors lose some degree of generality, but sometimes they gain some degree of readability in proofs.