RE: [PHP-DEV] [RFC] Typed Properties

2018-06-20 Thread Bob Weinand
> From: Marco Pivetta > Sent: Thursday, June 21, 2018 01:10 > To: Nikita Popov > Cc: PHP Internals List > Subject: Re: [PHP-DEV] [RFC] Typed Properties > > Hi Nikita, Bob, > > On Wed, 20 Jun 2018, 23:59 Nikita Popov, wrote: > > > Hi internals, > > > > Bob and I would like to present a new ty

Re: [PHP-DEV] [RFC] Typed Properties

2018-06-20 Thread Marco Pivetta
Hi Nikita, Bob, On Wed, 20 Jun 2018, 23:59 Nikita Popov, wrote: > Hi internals, > > Bob and I would like to present a new typed properties proposal for your > consideration: > > https://wiki.php.net/rfc/typed_properties_v2 > > The proposal allows you to annotate properties with types, which

[PHP-DEV] [RFC] Typed Properties

2018-06-20 Thread Nikita Popov
Hi internals, Bob and I would like to present a new typed properties proposal for your consideration: https://wiki.php.net/rfc/typed_properties_v2 The proposal allows you to annotate properties with types, which are enforced at runtime. Unlike the previous RFC on this topic, the new proposal

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Rowan Collins
On 20 June 2018 at 17:19, Levi Morrison wrote: > Bad behavior of existing functions does not mean we should create new > functions with the same bad behavior. If you believe lack of education > regarding array destructuring is an issue then we can use this example > specifically in the docs for t

Re: [PHP-DEV] [RFC][Discussion] iterable_to_array() and iterable_count()

2018-06-20 Thread Johannes Schlüter
On Mi, 2018-06-20 at 03:55 +0200, Michael Moravec wrote: > Hello internals, > > I'd like to propose two new functions for PHP 7.3: > iterable_to_array() and > iterable_count() > > These functions are supposed to work with iterables (7.1 pseudotype) > - both arrays and iterators, unlike iterator_*

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Levi Morrison
On Wed, Jun 20, 2018 at 10:03 AM Woortmann, Enno wrote: > > Am 20.06.2018 um 15:55 schrieb Levi Morrison: > > Your wish cannot be granted for `array_value_last` and > > `array_value_first`; you cannot know by itself if there is a failure > > condition. > > I can comprehend your issue with the lack

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Woortmann, Enno
Am 20.06.2018 um 15:55 schrieb Levi Morrison: Your wish cannot be granted for `array_value_last` and `array_value_first`; you cannot know by itself if there is a failure condition. I can comprehend your issue with the lack of distinctness between the error case and the 'real' array value null

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Rowan Collins
On 20 June 2018 at 15:29, Levi Morrison wrote: > > Ah, OK, you learn something every day! For anyone else like me who was > unaware of this, list() apparently silently accepts any non-array value on > the right of the assignment, assigns all variables in the list() to null, > and evaluates to the

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Levi Morrison
> Ah, OK, you learn something every day! For anyone else like me who was > unaware of this, list() apparently silently accepts any non-array value on > the right of the assignment, assigns all variables in the list() to null, and > evaluates to the assigned (but otherwise unused) value. So $x=li

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Rowan Collins
On 20 June 2018 at 15:10, Levi Morrison wrote: > On Wed, Jun 20, 2018 at 8:09 AM Rowan Collins > wrote: > > > > On 20 June 2018 at 14:55, Levi Morrison wrote: > >> > >> > >> if ([$key, $value] = array_last($input) { > >> // do something > >> } > >> > > > > > > Unfortunately, thi

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Nicolas Grekas
> It returns `?array`. So either `null` or `[$key, $value]`. There are > no notices; sorry for the lack of detail. > See https://3v4l.org/2hX3Y for example

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Levi Morrison
On Wed, Jun 20, 2018 at 8:09 AM Rowan Collins wrote: > > On 20 June 2018 at 14:55, Levi Morrison wrote: >> >> >> if ([$key, $value] = array_last($input) { >> // do something >> } >> > > > Unfortunately, this won't work. I didn't know list() could even be used as an > expression,

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Rowan Collins
On 20 June 2018 at 14:55, Levi Morrison wrote: > > if ([$key, $value] = array_last($input) { > // do something > } > > Unfortunately, this won't work. I didn't know list() could even be used as an expression, but apparently if it is, it evaluates to the whole array on its right-h

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Nicolas Grekas
> if ([$key, $value] = array_last($input) { > +1 for this proposal, I would even go one step further and suggest a single function, with an index as second argument: `if ([$key, $value] = array_index($input, $index) {` when `0 === $index` => returns the first, `-1 === $index` returns the las

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Levi Morrison
On Wed, Jun 20, 2018 at 3:17 AM Woortmann, Enno wrote: > > Hi Levi, > > > Am 20.06.2018 um 04:47 schrieb Levi Morrison: > > list($key, $value) = array_first($input); > > // $key will be null if the call failed > > > > list($key, $value) = array_last($input); > > // $key will be

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Gabriel Caruso
> > don't think I'm getting all the mail I am supposed to. I hope this gets > seen. > > I propose 2 functions *only* which I believe covers the use-cases that > all 4 of these do and more, with shorter names, and the ability to > discern whether the call succeeded or not. > > list($key, $value

Re: [PHP-DEV] Cleaning up unmaintained extensions - interbase

2018-06-20 Thread Lester Caine
On 20/06/18 10:25, Nikita Popov wrote: Just to clarify which bug I was referring to in that mail, it's this one: https://bugs.php.net/bug.php?id=72175 There are three issues that must be addressed: * The issue in the original bug report: Connecting to the same DB multiple times does not work.

Re: [PHP-DEV] Cleaning up unmaintained extensions - interbase

2018-06-20 Thread Nikita Popov
On Tue, Jun 19, 2018 at 11:47 PM, Lester Caine wrote: > On 19/06/18 21:48, Stanislav Malyshev wrote: > >> What Bug! >>> It's passing all the test that I run on it perfectly stably otherwise I >>> would not even bother with PHP7. But the problem supporting ANY driver >>> is the exotic nature of PH

Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last()

2018-06-20 Thread Woortmann, Enno
Hi Levi, Am 20.06.2018 um 04:47 schrieb Levi Morrison: list($key, $value) = array_first($input); // $key will be null if the call failed list($key, $value) = array_last($input); // $key will be null if the call failed Your proposed functions would be implementable with th

Re: [PHP-DEV] Cleaning up unmaintained extensions - interbase

2018-06-20 Thread Lester Caine
On 20/06/18 06:04, Stanislav Malyshev wrote: php7 builds are not that different from php5 builds, and I suspect the issues discovered are also present in earlier versions. Marius has had more luck understanding the nuances of changes and massaging my previous attempts in with his fixes, but I