To the best of my knowledge there isn't such a function. My suggestion for this would be either to return a second variable that indicates the type of the first, or to make sure that you always convert the variable to (e.g.) a string before returning it.
In some circumstances sys_move_raw (move raw data from one PCL variable to another, irrespective of type) can be useful, but I'm not sure that's what you want here.