Re: [PHP-DEV] RFC Weakrefs

2019-02-05 Thread Rowan Collins
On Tue, 5 Feb 2019 at 16:06, Dennis Birkholz wrote: > Maybe for PHP 8 we > will decide to require all classes to be serializable except classes > that implement the Unserializable interface or something... Or the magic > __isSerializable() method that can decide this at runtime for the actual > s

Re: [PHP-DEV] RFC Weakrefs

2019-02-05 Thread Girgias
On Tue, 5 Feb 2019 at 17:06, Dennis Birkholz wrote: > So I would really prefer the WeakReference class would just be > serializable with all the consequences you outlined. Maybe for PHP 8 we > will decide to require all classes to be serializable except classes > that implement the Unserializable

Re: [PHP-DEV] RFC Weakrefs

2019-02-05 Thread Dennis Birkholz
Hi Nikita, On 05.02.19 16:50, Nikita Popov wrote: Serialization for weak refs is a bit tricky, and I feel like supporting it could easily become a foot-gun. The fundamental problem is that for serialization to produce a meaningful value, the object referenced by a WeakReference must also be pa

Re: [PHP-DEV] RFC Weakrefs

2019-02-05 Thread Nikita Popov
On Tue, Feb 5, 2019 at 4:11 PM Dennis Birkholz wrote: > Hi Joe, > > On 02.02.19 09:35, Joe Watkins wrote: > > Some time ago I brought this up for discussion, and last night was > reminded > > of it's existence, and so this morning rebased and reworked the patch a > > little based on the feedback

Re: [PHP-DEV] RFC Weakrefs

2019-02-05 Thread Dennis Birkholz
Hi Joe, On 02.02.19 09:35, Joe Watkins wrote: Some time ago I brought this up for discussion, and last night was reminded of it's existence, and so this morning rebased and reworked the patch a little based on the feedback I got back then. Since it was long ago, and there's no particular rush,

Re: [PHP-DEV] RFC Weakrefs

2019-02-02 Thread Benjamin Morel
I was precisely hoping there was a WeakRef implementation the other day. This would be very useful for a simple data mapper, where you could keep references to loaded objects and a cache of their original properties, to compute the changeset to sync to the DB when save()ing them. WeakRefs would all

Re: [PHP-DEV] RFC WeakRefs

2018-05-18 Thread Rowan Collins
On 18 May 2018 13:15:21 BST, Etienne Kneuss wrote: >On Fri, May 18, 2018 at 1:59 PM Rowan Collins >wrote: > >> On 17 May 2018 10:35:11 BST, Etienne Kneuss wrote: >> >That said, if the plan is to subsume pecl-weakref, I suggest we also >> >reimplement weakmaps, which offer a convenient way of sto

Re: [PHP-DEV] RFC WeakRefs

2018-05-18 Thread Etienne Kneuss
On Fri, May 18, 2018 at 1:59 PM Rowan Collins wrote: > On 17 May 2018 10:35:11 BST, Etienne Kneuss wrote: > >That said, if the plan is to subsume pecl-weakref, I suggest we also > >reimplement weakmaps, which offer a convenient way of storing > >meta/cache > >data and is not implementable in use

Re: [PHP-DEV] RFC WeakRefs

2018-05-18 Thread Rowan Collins
On 17 May 2018 10:35:11 BST, Etienne Kneuss wrote: >That said, if the plan is to subsume pecl-weakref, I suggest we also >reimplement weakmaps, which offer a convenient way of storing >meta/cache >data and is not implementable in userland without trade-offs. It looks to me like WeakMap would be f

Re: [PHP-DEV] RFC WeakRefs

2018-05-17 Thread Joe Watkins
Morning, I'm aware the pecl extension also has weakmap support. I think we've enough time to vote on the implementation of weakrefs, and then think about how we want weak maps to work and vote on the implementation of that. Cheers Joe On Thu, May 17, 2018 at 11:35 AM, Etienne Kneuss wrote: >

Re: [PHP-DEV] RFC WeakRefs

2018-05-17 Thread Etienne Kneuss
On Thu, May 17, 2018 at 8:10 AM Joe Watkins wrote: > Morning internals, > > I'd like to raise for discussion https://wiki.php.net/rfc/weakrefs > > Am I missing anything ? > I'm all for implementing all this natively, the way it was implemented in pecl-weakref always felt hackish and brittle. Th

Re: [PHP-DEV] RFC WeakRefs

2018-05-17 Thread Joe Watkins
Morning Rowan, I've updated the RFC with a description of the API and comparison to the current WeakRef API documented by the pecl extension. Example code can be found in tests also ... Cheers Joe On Thu, May 17, 2018 at 9:36 AM, Rowan Collins wrote: > On 17 May 2018 07:09:28 BST, Joe Watkins

Re: [PHP-DEV] RFC WeakRefs

2018-05-17 Thread Rowan Collins
On 17 May 2018 07:09:28 BST, Joe Watkins wrote: >Morning internals, > >I'd like to raise for discussion https://wiki.php.net/rfc/weakrefs Hi Joe, Sounds exciting! What does this look like from userland? I'm guessing you wrap the object you want a weak reference to in a special container? If so