in reply to Style question - Modify passed arged if void context?
Yes. No. Ummm... It depends...
If you are going to have different behavior in void vs. scalar contexts, you need to be real clear in your docs. My gut tells me that such would be unexpected.
On the other hand, it may be appropriate for some circumstances (as the documentation will make clear).
That is, in the void context, it would seem to be apparent that I want to do process A on the data and set the data to those new values. In the scalar context, the function returns a new Data object which is stored in the new variable; $data may or may not be set with the new data as well.
Does processA change the input data or does it produce useful side effects? Why might the calling context be variable?
I think that the answers to those questions will clarify what the "right" behavior will be.
yours,
Michael
|
|---|