Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79452 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93854 invoked from network); 6 Dec 2014 03:04:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Dec 2014 03:04:25 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.177 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.223.177 mail-ie0-f177.google.com Received: from [209.85.223.177] ([209.85.223.177:64349] helo=mail-ie0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AD/FF-61462-83272845 for ; Fri, 05 Dec 2014 22:04:25 -0500 Received: by mail-ie0-f177.google.com with SMTP id rd18so1868961iec.22 for ; Fri, 05 Dec 2014 19:04:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=U+JHoAtt+QculziN09DZryrrLNbKsdBmkKniiX7sWSU=; b=A5Gz56YO/ExpeZYkThpS1613b6PoRasV7gVHfZH7sl0kVHL+OTREeH2p1vRjQTwgC2 +1uRsEG/SucTVE0YdWagZua7CWFiKWMK42nEhWLsY+01eA4LR/E7xz33CsjBq6LGRn8K qEOO7R9hkwirJYHWt9TQhLRrGjYIPJRau3Ob5RgZmLkF9ugfhPFbljQuGTSzlN85+vv6 ux7aUGRvObMiRjP4XDuYSyN5XmeMrL42WE/f2jF3R7lUb2n6YUPVC3zLhKgiOnqKKgzz yykrR8h5dzsJWwSnwgBTJTkOJpSzB5SiJzkgXsfWiNQTKukW/6wC4Ewzc0NBqVj4AMfp d3Yw== X-Received: by 10.50.35.195 with SMTP id k3mr5586697igj.11.1417835061347; Fri, 05 Dec 2014 19:04:21 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.107.164.217 with HTTP; Fri, 5 Dec 2014 19:03:41 -0800 (PST) In-Reply-To: <2D560BB1-318F-461F-96CD-BE25C346E14F@gmail.com> References: <2D560BB1-318F-461F-96CD-BE25C346E14F@gmail.com> Date: Sat, 6 Dec 2014 12:03:41 +0900 X-Google-Sender-Auth: 5-OoE43LG2fvX7F3QX4XDaWN8VY Message-ID: To: Rowan Collins Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1134af1a2e8da30509837379 Subject: Re: [PHP-DEV] Re: Only variables can be passed by reference From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1134af1a2e8da30509837379 Content-Type: text/plain; charset=UTF-8 Hi Rowan, On Fri, Dec 5, 2014 at 6:12 PM, Rowan Collins 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 yohgaki@ohgaki.net --001a1134af1a2e8da30509837379--