Re: [PHP-DEV] Operator overloading for userspace objects

2020-02-06 Thread Johannes Schlüter
On Wed, 2020-01-29 at 00:14 +0100, jan.h.boeh...@gmx.de wrote: > the last days I have experimented a bit with operator overloading in > userspace classes (redefing the meaning of arithmetic operations like Some historic context: I am probably the one who did operator overloading in PHP first. Olde

Re: [PHP-DEV] [RFC - discussion] __toArray()

2020-02-06 Thread AllenJB
What happens if I perform array-like operations on an object implementing __toArray() from this RFC? For example: $obj["foo"] = 42; or: $bar = $obj["foo"]; (Imagine these examples are perhaps within a loop iterating a collection of objects) Which operations do and do not work? As they'd b

Re: [PHP-DEV] Operator overloading for userspace objects

2020-02-06 Thread Chase Peeler
On Fri, Jan 31, 2020 at 10:55 AM Ben Ramsey wrote: > > Also, I want to reiterate: Any of these operations MUST be designed to > return a new value, never modify in place. These operators only make sense > on value objects, not service objects, and value objects should be > immutable. > > I compl

[PHP-DEV] Re: Changing the generated name for anon classes

2020-02-06 Thread Andrea Faulds
Hi, Nikita Popov wrote: Hi internals, Based on a suggestion by Nicolas Grekas, https://github.com/php/php-src/pull/5153 changes the generated name for anonymous classes to include the name of the parent class or first interface. So instead of just class@anonymous, you'll see something like Even

Re: [PHP-DEV] Operator overloading for userspace objects

2020-02-06 Thread Andrea Faulds
Hi, Nikita Popov wrote: Yes, i don't think it makes sense to group these operations in interfaces, the use-cases are just too diverse. It's possible to define one interface per operator (e.g. what Rust does), though I don't think this is going to be particularly useful in PHP. I would not want t

Re: [PHP-DEV] [RFC - discussion] __toArray()

2020-02-06 Thread Mike Schinkel
> > On Feb 6, 2020 at 7:06 AM, mailto:nikita@gmail.com)> > wrote: > > While there are quite a few places where objects can be implicitly > > converted to strings (say echo, concatenation, etc), there are not > > a lot of places where objects can be implicit

[PHP-DEV] PHP 7.5

2020-02-06 Thread Dik Takken
Hi all, Occasionally a change for PHP 8 is suggested and rejected because of it being too disruptive compared to PHP 7.4. This is unfortunate because it means we succeed less in seizing the opportunity to get language improvements into the 8.x series. In a recent thread about fixing a problem rel

Re: [PHP-DEV] Changing the generated name for anon classes

2020-02-06 Thread Nikita Popov
On Thu, Feb 6, 2020 at 2:45 PM Kingsquare.nl - Robin Speekenbrink < ro...@kingsquare.nl> wrote: > Nikita, > > Just to chime in here: would it be wise to add an interface instead? (this > would automatically be added by the engine) so that the consumer of a > generated class could *really* know bas

Re: [PHP-DEV] Changing the generated name for anon classes

2020-02-06 Thread Kingsquare.nl - Robin Speekenbrink
Nikita, Just to chime in here: would it be wise to add an interface instead? (this would automatically be added by the engine) so that the consumer of a generated class could *really* know based on the interface that it's a generated anonymous class instead of string type checking the classname? R

Re: [PHP-DEV] [RFC - discussion] __toArray()

2020-02-06 Thread Nikita Popov
On Tue, Feb 4, 2020 at 2:03 PM Steven Wade wrote: > Hi all, > > I’d like to officially open my __toArray() RFC < > https://wiki.php.net/rfc/to-array> up to discussion. I’ve delayed > changing the status until I had more time to respond to the discussion, but > since it’s been brought up again

Re: [PHP-DEV] Re: [RFC] "arrayable" pseudo type hint

2020-02-06 Thread Nikita Popov
On Tue, Feb 4, 2020 at 7:40 PM Aimeos | Norbert Sendetzky < norb...@aimeos.com> wrote: > Am 04.02.20 um 19:17 schrieb Rowan Tommins: > > I think Larry's point was that the flexibility of PHP's array type makes > it > > really hard to pin down whether a given object is "array-like" or not, > and >

Re: [PHP-DEV] Warn when declaring required parameter after optional one

2020-02-06 Thread Nikita Popov
On Wed, Feb 5, 2020 at 1:15 PM Guilliam Xavier wrote: > Hi, > > On Wednesday, February 5, 2020, Nikita Popov wrote: >> >> >> I like this idea and have updated the pull request to ignore the "Type >> $param = null" case, so the deprecation should now just catch the >> "definitely" incorrect signa

Re: [PHP-DEV] Planning an RFC to allow calls to global functions in constant expressions

2020-02-06 Thread Nikita Popov
On Sun, Feb 2, 2020 at 12:00 AM tyson andre wrote: > > Hi internals, > > I have a working implementation for calling global functions in constant > expressions at https://github.com/php/php-src/pull/5139 > (see PR description for more details, see tests for how edge cases get > resolved) > > If t

[PHP-DEV] Changing the generated name for anon classes

2020-02-06 Thread Nikita Popov
Hi internals, Based on a suggestion by Nicolas Grekas, https://github.com/php/php-src/pull/5153 changes the generated name for anonymous classes to include the name of the parent class or first interface. So instead of just class@anonymous, you'll see something like EventHandler@anonymous in error

[PHP-DEV] PHP 7.3.15RC1 is available for testing

2020-02-06 Thread Christoph M. Becker
PHP 7.3.15RC1 has just been released and can be downloaded from: Or use the git tag: php-7.3.15RC1 Windows binaries are available at: Please test it carefully, and report any bugs in the bug system. 7.3.15 should be expected in