in reply to Re^6: Use of wantarray Considered Harmful
in thread Use of wantarray Considered Harmful
What I meant by that was that the subroutine should always return the same information - changing context should be lossless. Hence, an array vs. an iterator (or an arrayref). But, not an array vs. the first element.
My criteria for good software:
As for your examples: localtime does array vs. joined array. That's on the border of acceptable. The diamond operator and readline are lossless - they are their own iterators (which is another rant for another day). m//g always returns a list - what you do with that list is your decision.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^8: Use of wantarray Considered Harmful
by ikegami (Patriarch) on Dec 19, 2008 at 23:04 UTC | |
Re^8: Use of wantarray Considered Harmful
by BrowserUk (Patriarch) on Dec 19, 2008 at 22:48 UTC |
In Section
Meditations