Sometimes when I work I write something like
\begin{proposition} \label{my new result}
...
\end{proposition}
...
blah blah in Proposition \ref{my new result} blah...
but then I realize that the Proposition should actually become a Lemma. So I change it to
\begin{lemma} \label{my new result}
...
\end{lemma}
The problem is that I then have to hunt down all the places where I wrote Proposition and change it to Lemma, which is tedious and error-prone. Well, we have search facilities in editors, so it is not really that complicated, but still it feels the wrong way to do this. I would be happier to write
\begin{proposition} \label{my new result}
...
\end{proposition}
...
blah blah in \labelNameFor{my new result} \ref{my new result} blah...
where labelNameFor is a hypothetical magic command which outputs "Proposition". Then I could forget about all the places where I reference the result and just make any changes I wish.
Is there a way to do something like this? As far as I understand the label/ref mechanism is simply based on counters, so I do not see a straightforward way, but maybe someone more clever and industrious then I am has given the problem some thought.