Re: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-28 Thread David Rodrigues
I think it useful, despite that it could be done by using array_push() as Woortmann said. Anyway, I think valid a new proposal for thinks like that. But I will suggests this: $arr[] = ... $items; Atenciosamente, David Rodrigues Em sáb., 28 de mar. de 2020 às 20:07, Michael Voříšek - ČVUT FEL

Re: [PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-28 Thread Enno Woortmann
Hi Michael, why not simply use array_push with multiple arguments? Something like: $a = []; array_push($a, ...array_fill(0, 10, 'x')); echo print_r($a, true); Cheers, Enno Am 29.03.2020 um 00:07 schrieb Michael Voříšek - ČVUT FEL: Hi all PHP gurus! This is a feature request / RFC for the foll

[PHP-DEV] Feature request - allow to append multiple elements to an array

2020-03-28 Thread Michael Voříšek - ČVUT FEL
Hi all PHP gurus! This is a feature request / RFC for the following use-case: $res = []; foreach ($arr as $i) { foreach (make_res($i) as $v) { $res[] = $v; } } Array_merge in loop is very sloop so it is not a solution. which I propose to shorten to: $res = []; foreach ($arr as $i) { $re

Re: [PHP-DEV] [RFC][DISCUSSION] switch expression

2020-03-28 Thread Ilija Tovilo
Hi Arnold > However, operations don't ever throw exceptions, but throw an error instead. I replaced it with a new, more fitting UnhandledSwitchCaseError. Thanks! Ilija -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] [DISCUSSION] Compact Object Property Assignment

2020-03-28 Thread Jakob Givoni
On Mon, Mar 16, 2020 at 6:48 AM Jakob Givoni wrote: > > Hello Internals, > > I'm opening up my new RFC for discussion: > > https://wiki.php.net/rfc/compact-object-property-assignment > - A pragmatic approach to object literals > > Let me know what you think! > > Best, > Jakob Hi again, Since the

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Andrea Faulds
Hi, Christoph M. Becker wrote: (frankly, I would not have not supported __concat() at all). Also, overloaded operators should be programmed defensively, i.e. they should not accept arbitrary arguments (how could that even work?), but only those they can handle. If implementations adhere to the

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Andrea Faulds
Hi everyone, Johannes Schlüter wrote: If we use two methods as well it is a saner design. I won't like it, but lot better than the current one. Just want to +1 this. Two methods, neither of which are static, seems like a cleaner approach to me. I maybe like this better than my suggested bo

Re: [PHP-DEV] [RFC] Allow trailing comma in parameter lists

2020-03-28 Thread Rowan Tommins
On 26/03/2020 18:52, Nikita Popov wrote: Hi internals, This has been declined in the past, but I just keep making this mistake, and believe it deserves reconsideration... https://wiki.php.net/rfc/trailing_comma_in_parameter_list Nikita Hi Nikita, While I'd personally be fine with this chan

[PHP-DEV] The perennial question of e-mail volume and off-list collaboration

2020-03-28 Thread Rowan Tommins
Hi Dan, I'm picking out the below into its own thread, to avoid derailing the particular RFC discussion where you mentioned it. On 28/03/2020 14:28, Dan Ackroyd wrote: I don't think this email list is a great place to work through all of those details. Email is not a great medium for this t

Re: [PHP-DEV] [RFC][DISCUSSION] switch expression

2020-03-28 Thread Arnold Daniels
Op za 28 mrt. 2020 13:40 schreef Ilija Tovilo : > Hi internals > > Apparently my previous emails were classified as junk (very > flattering). Hopefully that issue is fixed now. > > I'd like to move the RFC switch expression to "under discussion". It > tries to address some of the common issues wit

Re: [PHP-DEV] [RFC] Change default PDO error mode

2020-03-28 Thread Paul M. Jones
Hi there, > On Mar 28, 2020, at 14:02, AllenJB wrote: > > I believe it also brings the behavior inline with what developers would > actually expect the default to be in modern PHP. As do I. Every PDO wrapper I've ever written, one of the first things it does is set exceptions as the error mod

[PHP-DEV] [RFC] Change default PDO error mode

2020-03-28 Thread AllenJB
Hi, I present for discussion an RFC to change the default PDO error mode: https://wiki.php.net/rfc/pdo_default_errmode Previous discussion: https://externals.io/message/109015 I believe this change will help new developers who are presently presented only with knock-on errors, which can be co

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Johannes Schlüter
On March 28, 2020 5:44:28 PM GMT+01:00, Nikita Popov wrote: >On Sat, Mar 28, 2020 at 5:28 PM Johannes Schlüter > >wrote: > >> On Sat, 2020-03-28 at 17:05 +0100, Christoph M. Becker wrote: >> > On 28.03.2020 at 15:57, Johannes Schlüter wrote: >> > >> > > On March 28, 2020 1:25:11 PM GMT+01:00,

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Nikita Popov
On Sat, Mar 28, 2020 at 5:28 PM Johannes Schlüter wrote: > On Sat, 2020-03-28 at 17:05 +0100, Christoph M. Becker wrote: > > On 28.03.2020 at 15:57, Johannes Schlüter wrote: > > > > > On March 28, 2020 1:25:11 PM GMT+01:00, "Christoph M. Becker" < > > > cmbecke...@gmx.de> wrote: > > > > > > > Thi

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Johannes Schlüter
On Sat, 2020-03-28 at 17:05 +0100, Christoph M. Becker wrote: > On 28.03.2020 at 15:57, Johannes Schlüter wrote: > > > On March 28, 2020 1:25:11 PM GMT+01:00, "Christoph M. Becker" < > > cmbecke...@gmx.de> wrote: > > > > > This "try left/right" approach is how operator overloading works > > > for

Re: [PHP-DEV] [RFC][DISCUSSION] switch expression

2020-03-28 Thread Ilija Tovilo
Hi Dan First of all, thank you for your feedback. I appreciate your time. I think it's worth noting that the switch expression solves the problems it does implicitly, not directly. 1. Returning values: Of course, this is the main argument for the switch expression (regardless of the other issues

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Christoph M. Becker
On 28.03.2020 at 15:57, Johannes Schlüter wrote: > On March 28, 2020 1:25:11 PM GMT+01:00, "Christoph M. Becker" > wrote: > >> This "try left/right" approach is how operator overloading works for >> internal classes[1], and apparently, it works quite well, as long as it >> is not overused. > > T

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Christoph M. Becker
On 28.03.2020 at 14:29, Andrea Faulds wrote: > Christoph M. Becker wrote: > >> This "try left/right" approach is how operator overloading works for >> internal classes[1], and apparently, it works quite well, as long as it >> is not overused. > > I think “as long as it is not overused” are the key

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Johannes Schlüter
On March 28, 2020 1:25:11 PM GMT+01:00, "Christoph M. Becker" wrote: >On 28.03.2020 at 10:22, Arnold Daniels wrote: > >> This issues become even more apparent when sequencing operations like >`$a + >> $b + $c - $d`. Trying left, then trying right, will make it very >difficult >> to determine t

Re: [PHP-DEV] [RFC][DISCUSSION] switch expression

2020-03-28 Thread Dan Ackroyd
On Sat, 28 Mar 2020 at 12:40, Ilija Tovilo wrote: > > Hi internals > > I'd like to move the RFC switch expression to "under discussion". It > tries to address some of the common issues with the switch statement > by introducing a new switch expression. > > https://wiki.php.net/rfc/switch_expressio

[PHP-DEV] Re: Wiki karma request

2020-03-28 Thread Christoph M. Becker
On 28.03.2020 at 14:29, AllenJB wrote: > Please could I have rfc karma on the wiki account 'allenjb' to bring > forward my RFC for changing the default PDO error mode ( > https://externals.io/message/109015 ) Done. Good luck with the RFC. :) -- Christoph M. Becker -- PHP Internals - PHP Runtim

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Andrea Faulds
Hi Johannes, Johannes Schlüter wrote: I believe the pre-requisit is having some form of function overloading, where operator functions for specific argument types can be defined. In https://news-web.php.net/php.internals/108425 Andrea created an idea, which is probably "ugly" but has less usage

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Andrea Faulds
Hi, Christoph M. Becker wrote: On 28.03.2020 at 10:22, Arnold Daniels wrote: This issues become even more apparent when sequencing operations like `$a + $b + $c - $d`. Trying left, then trying right, will make it very difficult to determine the outcome of such a statement. The arguments again

[PHP-DEV] Wiki karma request

2020-03-28 Thread AllenJB
Hi, Please could I have rfc karma on the wiki account 'allenjb' to bring forward my RFC for changing the default PDO error mode ( https://externals.io/message/109015 ) Thanks in advance, AllenJB -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.ne

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Sebastian Bergmann
Am 27.03.2020 um 21:10 schrieb Johannes Schlüter: However I don't like this design. [...] Changed my vote back to "no" based on Johannes' arguments. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Andrea Faulds
Hi, Michał Brzuchalski wrote: The first thing is for operator methods when the operation is not supported I would see simply `return null;` as the right solution instead of constant, which name no one will remember. If we are to allow arbitrary use of operator overloading (rather than restric

[PHP-DEV] [RFC][DISCUSSION] switch expression

2020-03-28 Thread Ilija Tovilo
Hi internals Apparently my previous emails were classified as junk (very flattering). Hopefully that issue is fixed now. I'd like to move the RFC switch expression to "under discussion". It tries to address some of the common issues with the switch statement by introducing a new switch expression

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Christoph M. Becker
On 28.03.2020 at 10:22, Arnold Daniels wrote: > This issues become even more apparent when sequencing operations like `$a + > $b + $c - $d`. Trying left, then trying right, will make it very difficult > to determine the outcome of such a statement. > > The arguments against type hinting for operat

Re: [PHP-DEV] Function and operator overloading

2020-03-28 Thread Nikita Popov
On Sat, Mar 28, 2020 at 12:10 PM Terje Slettebø < terje.slett...@sandefjordbredband.net> wrote: > Hi. > > Please excuse me if this has been discussed to death earlier. I've tried > to search for it, but I've come up empty: > https://www.php.net/results.php? > q=function+overloading&l=en&p=all > Y

[PHP-DEV] Function and operator overloading

2020-03-28 Thread Terje Slettebø
Hi. Please excuse me if this has been discussed to death earlier. I've tried to search for it, but I've come up empty: https://www.php.net/results.php? q=function+overloading&l=en&p=all The recent discussion on operator overloading has highlighted the relationship between function overloading

Re: [PHP-DEV] [VOTE] Userspace operator overloading

2020-03-28 Thread Arnold Daniels
> > > On Mon, 2020-03-23 at 18:58 +0100, jan.h.boeh...@gmx.de wrote: > > Hi internals, > > > > I have opened voting on > > https://wiki.php.net/rfc/userspace_operator_overloading, which allows > > users to overload operators in their own classes. > > > > I consider operator overlaoding in general a

Re: [PHP-DEV] Interfaces and ReflectionMethod::isConstructor()

2020-03-28 Thread Sebastian Bergmann
Am 28.03.2020 um 08:44 schrieb Sebastian Bergmann: isConstructor()); Here is the version of the script for testing with dead versions of PHP: https://3v4l.org/fMCub -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] Interfaces and ReflectionMethod::isConstructor()

2020-03-28 Thread Sebastian Bergmann
I recently received a bug report for PHPUnit [1] that with PHP 8 test doubles (test stubs or mock objects) can no longer be created for interfaces that declare a constructor. I was able to reproduce this [2] and learned that PHPUnit's canMockMethod() [3] returns a different result on PHP 8 compare