On Sat, 2014-12-06 at 12:03 +0900, Yasuo Ohgaki wrote: > Hi Rowan, > > On Fri, Dec 5, 2014 at 6:12 PM, Rowan Collins <rowan.coll...@gmail.com> > wrote: > > > The author of function f1() presumably designed it to apply some change to > > $v, rather than executing only for its side effects and return value. If > > the caller wants to ignore this design, they can, but they are not using > > the function as it was designed. If they pass a function return straight > > into it, they have no way of capturing the change to $v which the author > > intended them to see. > > > The value supplied to f1() is return value. > In languages, there are literal, constant and variable. Return value is > variable. > It's better to keep basic rule. IMHO. > > $top = array_pop(f2()); > > is better than > > $v = f2(); > $top = array_pop($v); > > Is there anyone who likes latter? > Are there any other languages behave like PHP? > > Regards, > > -- > Yasuo Ohgaki > yohg...@ohgaki.net
A return value that has no references is a temporary variable, you forgot about temporary variables. There is a basic, simple rule; temporary variables cannot be used by reference, which is perfectly logical since there are no references to temporary variables, that's what makes them temporary. I don't see the need to change it. Cheers Joe -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php