Ashwin Sridhar wrote:
That's not what it's for. There's a better way to accomplish that
While implementing I thought it may not be for this purpose. Since everything worked out, I never bothered too much. What could be the downside of this approach ?
It's non-standard and may confuse whoever looks at the code in the future (you or other developers). It may have undesirable side effects. It may require some additional context or configuration that you can't assume will always be there.
Even if it always functions perfectly, the first reason is enough not to use it given that there are more conventional alternatives.
What are other better ways to accomplish this ?
Hard to say without more context as to how you're executing and what kind of setup you're doing.