Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Rowan Tommins
On 30 December 2020 08:43:33 GMT+00:00, Markus Fischer wrote: >What is the scalar value for a ScalarEnum if none is explicitly >defined? The question has no answer, because the declaration of the enum itself would be invalid: > If an enumeration is marked as having a scalar equivalent, then

[PHP-DEV] Re: Moving from SVN to git - finally!

2020-12-30 Thread Nikita Popov
On Tue, Dec 29, 2020 at 7:34 PM Andreas Heigl wrote: > Hey folks! > > After some years we are finally at the point to do what so many have > been asking for: We will move the source-control of the > PHP-Documentation from SVN to git! > > Tomorrow! > > TL;DR > > Tomorrow we will remove docs-karma

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Olle Härstedt
2020-12-30 18:31 GMT, Larry Garfield : > On Wed, Dec 30, 2020, at 12:15 PM, Rowan Tommins wrote: >> On 30/12/2020 13:49, Olle Härstedt wrote: >> > Uniqueness is when you only allow _one_ reference to an object (or >> > bucket of memory). >> > [...] >> > >> > You can compare a builder pattern with

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Larry Garfield
On Wed, Dec 30, 2020, at 12:42 PM, Olle Härstedt wrote: > A more motivating example for uniqueness is perhaps a query builder. > > ``` > $query = (new Query()) > ->select(1) > ->from('foo') > ->where(...) > ->orderBy(..) > ->limit(); > doSomething($query); > doSomethingElse($query); >

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Larry Garfield
On Wed, Dec 30, 2020, at 12:30 PM, Aleksander Machniak wrote: > On 28.12.2020 21:21, Larry Garfield wrote: > > https://wiki.php.net/rfc/enumerations > Why can't this be simplified to: > > enum Size { > case Small; > case Medium; > case Large; > } > > 'Small' === Size::Small->value; // true

RE: [PHP-DEV] Re: Documentation is on git

2020-12-30 Thread Daniel Lima
Great work Andreas, thanks for this. geekcom De: Adiel Cristo Enviado: quarta-feira, 30 de dezembro de 2020 13:17 Para: Andreas Heigl Cc: PHP Documentation ML ; PHP internals Assunto: [PHP-DEV] Re: Documentation is on git On Wed, Dec 30, 2020 at 11:19 AM

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Larry Garfield
On Wed, Dec 30, 2020, at 2:16 PM, Olle Härstedt wrote: > > Ok. You have a benchmark for this? I can make one otherwise, for the query > > example. > > > > It worries me a little that immutablility is pushed into the ecosystem as a > > silver bullet. Main reason functional languages are using it

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Larry Garfield
On Wed, Dec 30, 2020, at 6:27 AM, Rowan Tommins wrote: > On 28/12/2020 20:21, Larry Garfield wrote: > > After considerable discussion and effort, Ilija and I are ready to offer > > you round 2 on enumerations. > > > Thank you both, again, for all your efforts. I'm pleased to say that I > like

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Benjamin Morel
> > What's the quickest way (=less code) to have an enum represent it's > lexical name as the literal values? > > So that `… case Foo; case Bar; …` results in `::Foo->value === 'Foo'` etc.? > > Is this possible without implementing this manually for all cases? > > AFAICS, you'd need to implement

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Larry Garfield
On Wed, Dec 30, 2020, at 2:43 AM, Markus Fischer wrote: > Hi, > > On 28.12.20 21:21, Larry Garfield wrote: > > The full RFC is here, and I recommend reading it again in full given how > > much was updated. > > > > https://wiki.php.net/rfc/enumerations > > I tried to answer the following

Re: [PHP-DEV] Documentation is on git

2020-12-30 Thread Paul M. Jones
> On Dec 30, 2020, at 08:19, Andreas Heigl wrote: > > Hey folks! > > The PHP-Documentation has moved to git! Absolutely phenomenal. Well done all around! -- Paul M. Jones pmjo...@pmjones.io http://paul-m-jones.com Modernizing Legacy Applications in PHP https://leanpub.com/mlaphp

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Rowan Tommins
On 30/12/2020 13:49, Olle Härstedt wrote: Uniqueness is when you only allow _one_ reference to an object (or bucket of memory). [...] You can compare a builder pattern with immutability vs non-aliasing (uniqueness): ``` // Immutable $b = new Builder(); $b = $b->withFoo()->withBar()->withBaz();

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Larry Garfield
> > That's a good summary of why immutability and with-er methods (or some > > equivalent) are more ergonomic. > > > > Another point to remember: Because of PHP's copy-on-write behavior, full on > > immutability doesn't actually waste that much memory. It does use up some, > > but far less than

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Chuck Adams
On Wed, Dec 30, 2020 at 12:27 PM Larry Garfield wrote: > > If you clone the object, you don't duplicate 15+1 zvals. You duplicate just > the one zval for the object itself, which reuses the existing 15 internal > property entries. If in the new object you then update just the third one, >

Re: [PHP-DEV] Re: Documentation is on git

2020-12-30 Thread Sebastian Bergmann
Am 30.12.2020 um 17:17 schrieb Adiel Cristo: Thank you so much for this, Andreas, Nikita, and everyone involved! Hear, hear! -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Larry Garfield
On Wed, Dec 30, 2020, at 4:12 AM, Alexandru Pătrănescu wrote: > Nice evolution overall. > > Few notes: > - I think ScalarEnum::fromValue() would be more clear than just from() and > more in sync with ->value property. Any name would work, I suppose. I prefer short, single-word methods where

[PHP-DEV] Re: Documentation is on git

2020-12-30 Thread Adiel Cristo
On Wed, Dec 30, 2020 at 11:19 AM Andreas Heigl wrote: > Hey folks! > > The PHP-Documentation has moved to git! > > Not at the same day as the PHP8-release but at least in the same year ;-) > > Nikita and myself took the last steps today to finalize what a number of > people have been working on

Re: [PHP-DEV] Documentation is on git

2020-12-30 Thread Sara Golemon
On Wed, Dec 30, 2020 at 8:20 AM Andreas Heigl wrote: > The PHP-Documentation has moved to git! > > Stands. Begins slow clap. Clapping builds to a crescendo as the rest of the PHP community joins in. Loud whistling and hootin' and hollerin' are mixed into the cacophony. You are a hero. Some day

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Aleksander Machniak
On 28.12.2020 21:21, Larry Garfield wrote: > https://wiki.php.net/rfc/enumerations Why can't this be simplified to: enum Size { case Small; case Medium; case Large; } 'Small' === Size::Small->value; // true Size::from('Small') === Size::Small; // true enum Suit { case Hearts = 'H';

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Larry Garfield
On Wed, Dec 30, 2020, at 12:15 PM, Rowan Tommins wrote: > On 30/12/2020 13:49, Olle Härstedt wrote: > > Uniqueness is when you only allow _one_ reference to an object (or > > bucket of memory). > > [...] > > > > You can compare a builder pattern with immutability vs non-aliasing > > (uniqueness):

[PHP-DEV] Mysqli improvements

2020-12-30 Thread Kamil Tekiela
Hi Internals, I would like to start a discussion about possible improvements to the mysqli API. I have written an RFC which explains all my ideas. https://wiki.php.net/rfc/improve_mysqli As the RFC is nothing more than a concept at the moment I am looking for some feedback. I attempted to

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Olle Härstedt
2020-12-30 18:15 GMT, Rowan Tommins : > On 30/12/2020 13:49, Olle Härstedt wrote: >> Uniqueness is when you only allow _one_ reference to an object (or >> bucket of memory). >> [...] >> >> You can compare a builder pattern with immutability vs non-aliasing >> (uniqueness): >> >> ``` >> //

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Olle Härstedt
On Wed, 30 Dec 2020, 20:27 Larry Garfield, wrote: > > > > That's a good summary of why immutability and with-er methods (or some > > > equivalent) are more ergonomic. > > > > > > Another point to remember: Because of PHP's copy-on-write behavior, > full on > > > immutability doesn't actually

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Olle Härstedt
2020-12-30 19:50 GMT, Olle Härstedt : > On Wed, 30 Dec 2020, 20:27 Larry Garfield, wrote: > >> >> > > That's a good summary of why immutability and with-er methods (or >> > > some >> > > equivalent) are more ergonomic. >> > > >> > > Another point to remember: Because of PHP's copy-on-write

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Alexandru Pătrănescu
On Mon, Dec 28, 2020 at 10:22 PM Larry Garfield wrote: > > Hello, Internalians! > > After considerable discussion and effort, Ilija and I are ready to offer you round 2 on enumerations. This is in the spirit of the previous discussion, but based on that discussion a great deal has been reworked.

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Markus Fischer
Hi, On 28.12.20 21:21, Larry Garfield wrote: The full RFC is here, and I recommend reading it again in full given how much was updated. https://wiki.php.net/rfc/enumerations I tried to answer the following question but failed to do so: What is the scalar value for a ScalarEnum if none is

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Olle Härstedt
2020-12-29 22:43 GMT, Rowan Tommins : > On 29/12/2020 18:38, Olle Härstedt wrote: >> Instead of shoe-horning everything into the PHP object system, did >> anyone consider adding support for records instead, which would always >> be immutable, and could support the spread operator for cloning-with

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Olle Härstedt
2020-12-29 21:36 GMT, Rowan Tommins : > On 29/12/2020 10:28, Olle Härstedt wrote: >> I just want to mention that immutability might be applied too >> liberally in the current discourse, and in some cases, what you really >> want is*non-aliasing*, that is, uniqueness, to solve problems related >>

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Markus Fischer
On 30.12.20 12:00, Rowan Tommins wrote: On 30 December 2020 08:43:33 GMT+00:00, Markus Fischer wrote: What is the scalar value for a ScalarEnum if none is explicitly defined? The question has no answer, because the declaration of the enum itself would be invalid: If an enumeration is

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Rowan Tommins
On 28/12/2020 20:21, Larry Garfield wrote: After considerable discussion and effort, Ilija and I are ready to offer you round 2 on enumerations. Thank you both, again, for all your efforts. I'm pleased to say that I like this draft even more than the last one. :) A couple of points that

[PHP-DEV] Documentation is on git

2020-12-30 Thread Andreas Heigl
Hey folks! The PHP-Documentation has moved to git! Not at the same day as the PHP8-release but at least in the same year ;-) Nikita and myself took the last steps today to finalize what a number of people have been working on for the last at least 4 years. Thanks to Derick, Rasmus, Sara, Paul,

[PHP-DEV] Re: Documentation is on git

2020-12-30 Thread Jakub Zelenka
On Wed, Dec 30, 2020 at 2:19 PM Andreas Heigl wrote: > Hey folks! > > The PHP-Documentation has moved to git! > > Great work! And now I don't have an excuse for not updating the docs... :) Thanks Jakub

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Olle Härstedt
2020-12-30 20:37 GMT, Larry Garfield : > On Wed, Dec 30, 2020, at 2:16 PM, Olle Härstedt wrote: > >> > Ok. You have a benchmark for this? I can make one otherwise, for the >> > query >> > example. >> > >> > It worries me a little that immutability is pushed into the ecosystem >> > as a >> > silver

Re: [PHP-DEV] [RFC] Bundling ext/simdjson into core

2020-12-30 Thread Jakub Zelenka
On Wed, Dec 30, 2020 at 6:52 AM Remi Collet wrote: > Le 29/12/2020 à 17:57, Máté Kocsis a écrit : > > Hi Internals, > > > > I think this will be my last proposal for quite some while :) > > But this time, I'd like to propose bundling the > > https://github.com/crazyxman/simdjson_php extension >

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Mike Schinkel
> On Dec 30, 2020, at 1:15 PM, Rowan Tommins wrote: > > On 30/12/2020 13:49, Olle Härstedt wrote: >> Uniqueness is when you only allow _one_ reference to an object (or >> bucket of memory). >> [...] >> >> You can compare a builder pattern with immutability vs non-aliasing >> (uniqueness): >>

Re: [PHP-DEV] [RFC] Bundling ext/simdjson into core

2020-12-30 Thread Máté Kocsis
Hi Remi and Jakub, > I agree it's too early as the library is young and won't be available in >> many distros. The PECL path is better in this case IMO as it will allow >> some time . > > In my opinion, this is a case where making an exception is worth considering. Should the simdjson library be

Re: [PHP-DEV] [RFC] Enumerations, Round 2

2020-12-30 Thread Aleksander Machniak
On 30.12.2020 21:21, Larry Garfield wrote: >> enum Suit { >> case Hearts = 'H'; >> case Diamonds = 'D'; >> case Clubs = 'C'; >> case Spades = 'S'; >> } >> >> 'H' === Suit::Hearts->value; // true >> 'Hearts' === Suit::Hearts->value; // false > > That's a possibility we've been kicking

Re: [PHP-DEV] Analysis of property visibility, immutability, and cloning proposals

2020-12-30 Thread Olle Härstedt
2020-12-30 21:27 GMT, Olle Härstedt : > 2020-12-30 20:37 GMT, Larry Garfield : >> On Wed, Dec 30, 2020, at 2:16 PM, Olle Härstedt wrote: >> >>> > Ok. You have a benchmark for this? I can make one otherwise, for the >>> > query >>> > example. >>> > >>> > It worries me a little that immutability is