[PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Joe Watkins
Hi internals, In response to: https://bugs.php.net/bug.php?id=78480 I implemented: https://github.com/php/php-src/pull/7029 Not absolutely convinced that it's a good idea, I asked Nikita to review, and he's unconvinced also and suggested a discussion should be started. You can read both of our

[PHP-DEV] Re: [RFC] [Draft] Add Randomizer class (before: Add RNG extension)

2021-05-26 Thread Guilliam Xavier
On Tue, May 25, 2021 at 5:36 PM Go Kudo wrote: > Hi, Thanks for the response. > > The RFC has been revised based on the points you pointed out. > > https://wiki.php.net/rfc/rng_extension > Thanks, it looks like you have addressed all previous points (for me at least). But also introduced a new o

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Hossein Baghayi
On Wed, 26 May 2021 at 10:14, Hamza Ahmad wrote: > Thus, array() or [] will return scaler array object, > Hello, This doesn't seem trivial to me. I mean, should array object be passed by value or by reference? Arrays are passed by value by default so far, and objects are be-ref internally. If we

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Marco Pivetta
On Wed, May 26, 2021 at 12:14 PM Joe Watkins wrote: > Hi internals, > > In response to: https://bugs.php.net/bug.php?id=78480 > > I implemented: https://github.com/php/php-src/pull/7029 > > Not absolutely convinced that it's a good idea, I asked Nikita to review, > and he's unconvinced also and s

Re: [PHP-DEV] Disable autovivification on false

2021-05-26 Thread Guilliam Xavier
On Tue, May 25, 2021 at 10:27 PM Dusk wrote: > On May 25, 2021, at 09:23, Kamil Tekiela wrote: > > I'd like to start a discussion on the following RFC > > https://wiki.php.net/rfc/autovivification_false > > Particularly, I am looking for opinions on whether this behaviour should > be > > left al

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Joe Watkins
Hi Marco, What do you mean by "meaningful benchmarks" ? There's no question that is_initialized will be faster than the reflector version, even with reflection caching. Here's a naive bench: https://gist.github.com/krakjoe/cef6452281624bdf1b46788f52a01521 krakjoe@Fiji:/opt/src/php-src$ sapi/cli

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Mike Schinkel
> On May 25, 2021, at 6:28 PM, Iván Arias wrote: > > Hi all, > > It sounds like scalar objects by Nikita: > https://github.com/nikic/scalar_objects Yes, but Nikita wrote this note about technical limitations at the bottom of the repo README: Due to technical limitations, it is not possibl

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Marco Pivetta
Hey Joe, On Wed, May 26, 2021 at 12:56 PM Joe Watkins wrote: > Hi Marco, > > What do you mean by "meaningful benchmarks" ? > > There's no question that is_initialized will be faster than the reflector > version, even with reflection caching. > Ack, but real-world

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Marco Pivetta
On Wed, May 26, 2021 at 1:03 PM Mike Schinkel wrote: > > > > On May 25, 2021, at 6:28 PM, Iván Arias wrote: > > > > Hi all, > > > > It sounds like scalar objects by Nikita: > https://github.com/nikic/scalar_objects > > Yes, but Nikita wrote this note about technical limitations at the bottom > o

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Hamza Ahmad
> should array object be passed by value or by reference? > If we are to have array object, will it be exceptional? By value. Because array is a data type, we are talking about making it behave like object. In JavaScript, Arrays, Strings, and Numbers are objects; they have their respective propert

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Michał Marcin Brzuchalski
śr., 26 maj 2021 o 12:14 Joe Watkins napisał(a): > Hi internals, > > In response to: https://bugs.php.net/bug.php?id=78480 > > I implemented: https://github.com/php/php-src/pull/7029 > > Not absolutely convinced that it's a good idea, I asked Nikita to review, > and he's unconvinced also and sugg

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Joe Watkins
Thanks Michal for input ... > Ack, but real-world impact seems irrelevant? I've worked on stuff that heavily relies on checking initialized state, and most of it is mostly unaffected. "meaningful benchmark" means "here's a use-case that really needs `is_initialized()`, and absolutely cannot run in

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Rowan Tommins
On 26/05/2021 11:13, Joe Watkins wrote: Hi internals, In response to: https://bugs.php.net/bug.php?id=78480 I implemented: https://github.com/php/php-src/pull/7029 My general feeling remains that the "uninitialized" state is an awkward hack that we should be working to eliminate with better

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Larry Garfield
On Wed, May 26, 2021, at 8:24 AM, Rowan Tommins wrote: > On 26/05/2021 11:13, Joe Watkins wrote: > > Hi internals, > > > > In response to: https://bugs.php.net/bug.php?id=78480 > > > > I implemented: https://github.com/php/php-src/pull/7029 > > > My general feeling remains that the "uninitialized

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Guilliam Xavier
On Wed, May 26, 2021 at 4:09 PM Larry Garfield wrote: > On Wed, May 26, 2021, at 8:24 AM, Rowan Tommins wrote: > > On 26/05/2021 11:13, Joe Watkins wrote: > > > Hi internals, > > > > > > In response to: https://bugs.php.net/bug.php?id=78480 > > > > > > I implemented: https://github.com/php/php-sr

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Rowan Tommins
On 26/05/2021 17:20, Guilliam Xavier wrote: I think you said the word: serialization. And especially*deserialization*, e.g. from a JSON payload into a typed DTO*without* calling the constructor (then the DTO is passed through validation, which must handle uninitialized typed properties "graceful

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Sara Golemon
On Tue, May 25, 2021 at 4:20 AM Karoly Negyesi wrote: > I was wondering whether $array->map($somefunction) would be possible. I am > not a C programmer by any stretch but reading ZEND_VM_HOT_OBJ_HANDLER(112 > it seems to me it should be quite easy (famous last words) to find out if > object is an

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread Michał Marcin Brzuchalski
śr., 26 maj 2021 o 18:20 Guilliam Xavier napisał(a): > On Wed, May 26, 2021 at 4:09 PM Larry Garfield > wrote: > > > On Wed, May 26, 2021, at 8:24 AM, Rowan Tommins wrote: > > > On 26/05/2021 11:13, Joe Watkins wrote: > > > > Hi internals, > > > > > > > > In response to: https://bugs.php.net/bug

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Mike Schinkel
> On May 26, 2021, at 2:34 PM, Sara Golemon wrote: > > What I don't like about the specific proposal is that it's just a little > too magic in its function selection and argument mapping. There's also the > fact that it doesn't leave room to improve specifics about the > implementations of the m

Re: [PHP-DEV] Consensus Gathering: is_initialized

2021-05-26 Thread David Gebler
On Wed, May 26, 2021 at 11:14 AM Joe Watkins wrote: > Hi internals, > > In response to: https://bugs.php.net/bug.php?id=78480 > > I implemented: https://github.com/php/php-src/pull/7029 > > Not absolutely convinced that it's a good idea, I asked Nikita to review, > and he's unconvinced also and s

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Sara Golemon
On Wed, May 26, 2021 at 2:36 PM Mike Schinkel wrote: > On May 26, 2021, at 2:34 PM, Sara Golemon wrote: > > > What I don't like about the specific proposal is that it's just a little > too magic in its function selection and argument mapping. There's also the > fact that it doesn't leave room t

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Larry Garfield
On Wed, May 26, 2021, at 4:31 PM, Sara Golemon wrote: > On Wed, May 26, 2021 at 2:36 PM Mike Schinkel wrote: > > > On May 26, 2021, at 2:34 PM, Sara Golemon wrote: > > > > > > What I don't like about the specific proposal is that it's just a little > > too magic in its function selection and arg

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Hendra Gunawan
Hello. > > Yes, but Nikita wrote this note about technical limitations at the bottom of > the repo README: > > Due to technical limitations, it is not possible to create mutable APIs for > primitive types. Modifying $self within the methods is not possible (or > rather, will have no effect, as yo