in reply to How much can a function know about the context in which it is called?
Note that the context doesn't tell you what happens with the return values or what the user wants to do.
For instance, in this common idiom, function() is in list context but I want to the output in @values, not printed. I wouldn't like functions that try to be smarter than me.
my @values = map { function( $_ ) } @input;
Every time I've thought it would be good to simply print to STDOUT, someone comes along and wants the output in some other way. Instead of making the function know that stuff, I let the user decide. I can always make a print_function() that does that and still lets me use the "dumb" version/ :)
|
|---|