Thank you for your detailed explanation.
I went through the entire documentation again, and it seems that in Hugo the only way to return an object is indeed using return. As you mentioned, the only way to debug is either using warnf, returning the object, or save it using Store method.