Integral of a generalized function Let $\mathcal{S}$ be a Schwartz space and $\delta_{a}$ the following distribution:
$$\delta_{a}: \phi \rightarrow \phi(a) \ \ \ \ \text{ for each } \phi\in\mathcal{S}$$
Now, we routinely see something like: $$\int_{-\infty}^{\infty} f(x)\delta_a dx = f(a)$$
where $f$ is not necessarily $\in \mathcal{S}$ (e.g. $f \in L^2$). I'm having a hard time interpreting this integral using the language of distributions.
For example, if $f$ was in $\mathcal{S}$, I could say the integral is just giving me the value of the functional $\delta_a$ at a point in $\mathcal{S}$. But what about when $f\notin \mathcal{S}$?
 A: It's an abuse of notation. Essentially it is defined by
$$
\int_{-\infty}^\infty \delta(x)\varphi(x) \,dx := \langle \delta, \varphi\rangle
$$
for $\varphi\in C^\infty_0(\Bbb R)$, where $\langle \delta, \varphi\rangle$ denotes the dual paring. Note that this actually makes sense for any $\varphi\in C^\infty(\Bbb R)$ since $\delta$ is a distribution of compact support (and even for $\varphi\in C(\Bbb R)$ because $\delta$ can be identified with a Radon measure). 
Note that $\int_{-\infty}^\infty \delta(x)f(x) \,dx$ does not make sense for $f \in L^2(\Bbb R)$ since elements of $L^2$ are only defined an equivalent classes and $f(0)$ is not well-defined for $f\in L^2$.
I gave a more thorough answer to a very similar question here.
A: Actually, the notation $\int T$ for a distribution $T$ was introduced by L. Schwartz in his book Theorie des distributions (on page 203 in the 1966 edition). By definition, it is given by $\int T = \langle T, 1 \rangle$, which is evaluation at the constant test function 1. This is of course not possible for all distributions but only for so-called integrable distributions $T \in \mathcal{D}'_{L^1} = (\dot{\mathcal{B}})'$, where $\dot{\mathcal{B}}$ is the space of smooth functions whose derivatives of any order vanish at infinity. Although the latter space does not contain $1$, one can show that $\mathcal{D}'_{L_1}$ also equals the dual space of $\mathcal{B}$, the space of all smooth functions which are bounded together with their derivatives of any order (much more details are available in Schwartz' book), hence this evaluation is well-defined.
With this background, integrals $$\int T(x) \varphi(x) dx$$ make sense whenever the product $T\varphi$ is an element of $\mathcal{D}'_{L^1}$.
A: $\delta_a$ is a distribution with compact support {$a$}. (See this question for a definition and the first answer for an easy to understand explanation of the support of a distribution.)
Since such a distribution "doesn't do anything outside its support", it is irrelevant what the test functions do outside that support: you can evaluate the distribution on any $\varphi \in C^\infty$ by replacing $\varphi$ with a compactly supported $\psi \in D$ which is equal to $\varphi$ just on the support of the distribution, and vanishes further away.
