Support ref as a function.