Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-07 Thread Lester Caine
On 07/12/14 09:33, Rowan Collins wrote: > You keep talking about these "errors" being a burden on the programmer, but > accepting that in principle it would be better to avoid such situations, so I > want to reiterate: these are Strict Standards hints - they tell the > programmer "we're not goin

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-07 Thread Rowan Collins
On 6 December 2014 22:25:50 GMT, Yasuo Ohgaki wrote: >Hi Rowan, > >On Sat, Dec 6, 2014 at 11:25 PM, Rowan Collins > >wrote: > >> On 06/12/2014 03:03, Yasuo Ohgaki wrote: >> >>> Hi Rowan, >>> >>> On Fri, Dec 5, 2014 at 6:12 PM, Rowan Collins >>> > wrote: >>> >>>

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread Andrea Faulds
Hi! > On 6 Dec 2014, at 22:25, Yasuo Ohgaki wrote: > > Value is vague term. I would like to use "expression". Expression is > anything that has value. > Variables/constants are values that have actual storage. > Literals are values that may not have actual storage. The C world already has termi

Re: Fwd: Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread Yasuo Ohgaki
Hi Rowan, On Sat, Dec 6, 2014 at 11:38 PM, Rowan Collins wrote: > function foo(&$bar=null) { ... } Default value for pass-by-ref parameter is matter to discuss. It's nicer if it is allowed. It would be done by creating temporary variable, I suppose. Regards, -- Yasuo Ohgaki yohg...@ohgaki.ne

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread Yasuo Ohgaki
Hi Rowan, On Sat, Dec 6, 2014 at 11:25 PM, Rowan Collins wrote: > On 06/12/2014 03:03, 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 >>

Re: Fwd: Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread Rowan Collins
On 04/12/2014 23:46, Chris Wright wrote: Forgot to cc list, see below -- Forwarded message -- From: "Chris Wright" Date: 4 Dec 2014 14:09 Subject: Re: [PHP-DEV] Re: Only variables can be passed by reference To: "Andrea Faulds" Cc: On 4 December 2014 at

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread Rowan Collins
On 06/12/2014 11:00, Christoph Becker wrote: Yasuo Ohgaki wrote: 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?

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread Rowan Collins
On 06/12/2014 03:03, 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.

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread Christoph Becker
Yasuo Ohgaki wrote: > 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 la

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread 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 call

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-06 Thread Patrick Schaaf
Am 06.12.2014 04:04 schrieb "Yasuo Ohgaki" : > > $top = array_pop(f2()); > > is better than > > $v = f2(); > $top = array_pop($v); > > Is there anyone who likes latter? It is bad practise either way, having poor f2() build up a whole array that is then immediately thrown away. The second case is w

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-05 Thread Yasuo Ohgaki
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

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-05 Thread Eugene
Hi Yasuo, On Thu, Dec 4, 2014 at 11:38 AM, Yasuo Ohgaki wrote: > Hi all, > > Sorry for multiple posts. This would be the last one. > > On Thu, Dec 4, 2014 at 7:08 PM, Yasuo Ohgaki wrote: > > > On Thu, Dec 4, 2014 at 5:28 PM, Yasuo Ohgaki wrote: > > > >> I think we can get rid of this error now

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-05 Thread Rowan Collins
On 5 December 2014 01:07:03 GMT, Yasuo Ohgaki wrote: >Hi all, > >On Thu, Dec 4, 2014 at 5:28 PM, Yasuo Ohgaki >wrote: > >> I think we can get rid of this error now when literal is returned. >> The reason we have E_STRICT error is that legacy PHP didn't >> support this, I suppose. >> >> http://3v4

[PHP-DEV] Re: Only variables can be passed by reference

2014-12-04 Thread Yasuo Ohgaki
Hi all, On Thu, Dec 4, 2014 at 5:28 PM, Yasuo Ohgaki wrote: > I think we can get rid of this error now when literal is returned. > The reason we have E_STRICT error is that legacy PHP didn't > support this, I suppose. > > http://3v4l.org/8fISj > > Is it possible to allow literal as referenced pa

Fwd: Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-04 Thread Chris Wright
Forgot to cc list, see below -- Forwarded message -- From: "Chris Wright" Date: 4 Dec 2014 14:09 Subject: Re: [PHP-DEV] Re: Only variables can be passed by reference To: "Andrea Faulds" Cc: > On 4 December 2014 at 12:26, Andrea Faulds wrote: >> &g

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-04 Thread Yasuo Ohgaki
Hi Levi, On Fri, Dec 5, 2014 at 8:14 AM, Levi Morrison wrote: > > Even when there is parameter to pass, user has to create variable always. > > > > select_select([$a], [$b], [$c], 10); > > > > fails with E_ERROR, while > > > > $x = [$a]; > > $y = [$b]; > > $z = [$c]; > > stream_select($x, $y, $z

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-04 Thread Levi Morrison
> Even when there is parameter to pass, user has to create variable always. > > select_select([$a], [$b], [$c], 10); > > fails with E_ERROR, while > > $x = [$a]; > $y = [$b]; > $z = [$c]; > stream_select($x, $y, $z, 10); > > works, but It does not look nice. >From the documentation: "Also do not f

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-04 Thread Yasuo Ohgaki
Hi Andrea, Stas and all On Thu, Dec 4, 2014 at 9:26 PM, Andrea Faulds wrote: > > > $sock = fsockopen('www.php.net', '80'); > > var_dump($sock); > > > > $socks = array($sock); > > var_dump(stream_select($socks, $socks, $socks, 1)); > > > > //var_dump(stream_select(array($sock), array($sock), arr

Re: [PHP-DEV] Re: Only variables can be passed by reference

2014-12-04 Thread Andrea Faulds
> On 4 Dec 2014, at 10:38, Yasuo Ohgaki wrote: > > > Yet another sample code. This cannot be executed on 3v4l.org for security > reasons. > > $sock = fsockopen('www.php.net', '80'); > var_dump($sock); > > $socks = array($sock); > var_dump(stream_select($socks, $socks, $socks, 1)); > > //var

[PHP-DEV] Re: Only variables can be passed by reference

2014-12-04 Thread Yasuo Ohgaki
Hi all, Sorry for multiple posts. This would be the last one. On Thu, Dec 4, 2014 at 7:08 PM, Yasuo Ohgaki wrote: > On Thu, Dec 4, 2014 at 5:28 PM, Yasuo Ohgaki wrote: > >> I think we can get rid of this error now when literal is returned. >> The reason we have E_STRICT error is that legacy PH

[PHP-DEV] Re: Only variables can be passed by reference

2014-12-04 Thread Yasuo Ohgaki
Hi all, On Thu, Dec 4, 2014 at 5:28 PM, Yasuo Ohgaki wrote: > I think we can get rid of this error now when literal is returned. > The reason we have E_STRICT error is that legacy PHP didn't > support this, I suppose. > > http://3v4l.org/8fISj > > Is it possible to allow literal as referenced pa