Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79454 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11735 invoked from network); 6 Dec 2014 09:26:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Dec 2014 09:26:51 -0000 Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.212.170 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:54763] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F0/80-06932-9DBC2845 for ; Sat, 06 Dec 2014 04:26:51 -0500 Received: by mail-wi0-f170.google.com with SMTP id bs8so3394724wib.1 for ; Sat, 06 Dec 2014 01:26:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=pOnAFIfL8O0aVzYqMYKiYPtpIF6zE/nwnCL5qv+r0lc=; b=SRRVt0/qWhi+M5yvtRGsKy7GbeL4oHSkw3bzbWtYfLwLhnpjlrjWejf0gUD++PW/pN RmLDaqMLgwfB/3+q0iQZtw4ayv+AcEC8BLlnRQPHeVbU43k74XtLAGr/UQAAhzx7cLnV Xt9aWxmp6f9Ew7/tVDcyBdkGO3hpSSA4MK945KuJL8CFMkLEFScJMhMkZf7OWHIVNPJp JATp6VSc6EFb4XrlxhhG8IW81mxxGyOwSLzjYfHV1d3XtKqPhZx72NsNhLpjGIImRixO HPKjRoMXQS3mwP4NhfLGmZFj/gNN77OHfHzExxG7wnxs/qfSWm96uNiPzQDkhbrFohzZ yRdg== X-Gm-Message-State: ALoCoQmkZdaVG4ZrSQ0k1gqK8/L6yHhi7OfuKSB5VJe5LMAT8dl7iwMYJwd83wRVYJoDIbA1cpj2 X-Received: by 10.194.120.164 with SMTP id ld4mr30904416wjb.67.1417858006647; Sat, 06 Dec 2014 01:26:46 -0800 (PST) Received: from [192.168.1.67] (host86-159-155-48.range86-159.btcentralplus.com. [86.159.155.48]) by mx.google.com with ESMTPSA id nb8sm1220349wic.7.2014.12.06.01.26.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 06 Dec 2014 01:26:45 -0800 (PST) Message-ID: <1417858003.2495.16.camel@localhost.localdomain> To: Yasuo Ohgaki Cc: Rowan Collins , "internals@lists.php.net" Date: Sat, 06 Dec 2014 09:26:43 +0000 In-Reply-To: References: <2D560BB1-318F-461F-96CD-BE25C346E14F@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Only variables can be passed by reference From: pthreads@pthreads.org (Joe Watkins) 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 > 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 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