Why are function spaces typically defined on open sets?

I never really bothered to ask this question and now it seems silly...but why do we always seem to define function spaces $X(U)$ (e.g. $L^2(U), BV(U)$ for open sets $U\subset\Bbb{R}^n$? What breaks if we consider closed $U$? For example, $L^2([0,1]^2)$ seems perfectly natural to me.

• $[0,1]$ appears frequently? In any case, wild functions prefer open spaces... – copper.hat Apr 8 '14 at 6:33
• @copper.hat do you maybe have an example of a function/property that only make sense for open sets? (I would imagine some kind of topoligist's sine curve...?) – icurays1 Apr 8 '14 at 6:35
• I don't really have any good examples. Maybe the space of invertible matrices? – copper.hat Apr 8 '14 at 6:39
• I always thought it is because finite sets are always closed under the usual topologies and in such sets differentiability is problematic. – Git Gud Apr 8 '14 at 6:53

First, there is a difference between $C([0,1])$ and $C((0,1))$ - the spaces of functions that are continuous on the closed and open interval, respectively. There is no difference between $L^2([0,1])$ and $L^2((0,1))$ though.