In the book of Analysis On Manifold by Munkres, at page 144, in the exercise 3.a, the author defines differentiability for an arbitrary subset $S$ of $\mathbb{R}^n$ as
Let $S$ be an arbitrary subset of $\mathbb{R}^n$; let $x_0 \in S$. We say that $f:S \to \mathbb{R}$ is diff'able at $x_0$, of class $C^r$, provided that there is a a $C^r$ function $g: U\to \mathbb{R}$ defined in a neighbourhood of $U$ of $x_0$ in $\mathbb{R}^n$, such that $g$ agrees with $f$ on the set $U \cap S$.
However, considering the answers given to this question, how is the above definition common and used ?