Re: [PHP-DEV] Immutability RFC

2016-11-21 Thread Lester Caine
On 21/11/16 08:46, Mathieu Rochette wrote: >> The term 'immutable", especially for the property-annotation, doesn't >> strictly seem correct to me either, as for example, I can annotate a >> public >> property as immutable, but if I put an object in there, that object is >> not >> necessarily immut

Re: [PHP-DEV] Immutability RFC

2016-11-21 Thread Silvio Marijić
@Rasmus We are not changing behaviour of operators since we are not dealing here just with Value Objects. It's not even a question that matter of this RFC can be achieved with encapsulation. Already there are couple of features that got passed, which also could be achieved without 'syntax' sugar,

Re: [PHP-DEV] Immutability RFC

2016-11-21 Thread Mathieu Rochette
On 20/11/2016 20:25, Rasmus Schultz wrote: Reading through the RFC and the replies, I'm confused about this question. Why would the comparison operators work any differently on immutable objects? If these were value objects, the question would make sense, but it doesn't sound like that's what

Re: [PHP-DEV] Immutability RFC

2016-11-20 Thread Rasmus Schultz
Reading through the RFC and the replies, I'm confused about this question. Why would the comparison operators work any differently on immutable objects? If these were value objects, the question would make sense, but it doesn't sound like that's what you're proposing? With regards to the feature

Re: [PHP-DEV] Immutability RFC

2016-11-20 Thread Silvio Marijić
@Larry, I see your point, but when I said 'identity', I was thinking about referential identity, not wether that object has identity in the user application. Cheers On Nov 19, 2016 7:15 PM, "Larry Garfield" wrote: > I'm not Paul, but... > > If you have a data storage system using CRAP (Create R

Re: [PHP-DEV] Immutability RFC

2016-11-19 Thread Paul Jones
> On Nov 19, 2016, at 13:22, Michał Brzuchalski > wrote: > > In Event Sourced application Aggregates and Entities are mutable but > pushing Events for later write but speaking of ValueObject which ideally > could be immutable classes there is must on immutability and AFAIK there is > no need fo

Re: [PHP-DEV] Immutability RFC

2016-11-19 Thread Michał Brzuchalski
19.11.2016 19:15 "Larry Garfield" napisał(a): > > I'm not Paul, but... > > If you have a data storage system using CRAP (Create Read Archive Purge) instead of CRUD, or EventSourcing, or any other system that needs to maintain history, then you need stored objects that have identities (document abc

Re: [PHP-DEV] Immutability RFC

2016-11-19 Thread Larry Garfield
I'm not Paul, but... If you have a data storage system using CRAP (Create Read Archive Purge) instead of CRUD, or EventSourcing, or any other system that needs to maintain history, then you need stored objects that have identities (document abc revision 123, for instance) so you can reference

Re: [PHP-DEV] Immutability RFC

2016-11-16 Thread Silvio Marijić
@Paul, I understand that immutable doesn't automatically apply value object. Can you give us some examples where immutable object should have identity? Cheers On Nov 16, 2016 4:48 PM, "Paul Jones" wrote: > > > On Nov 16, 2016, at 07:57, Silvio Marijić > wrote: > > > > Hi, > > > > To anyone who

Re: [PHP-DEV] Immutability RFC

2016-11-16 Thread Michał Brzuchalski
16.11.2016 16:39 "David Rodrigues" napisał(a): > > 2016-11-16 11:57 GMT-02:00 Silvio Marijić : > > If we treat those objects as values then this should return true. But then > > again there might be some confusion because then two operators are doing > > the same thing. Maybe throw an error ? Sugg

Re: [PHP-DEV] Immutability RFC

2016-11-16 Thread Paul Jones
> On Nov 16, 2016, at 07:57, Silvio Marijić wrote: > > Hi, > > To anyone who is interested in this RFC. What do you think what behavour we > should have when you try to compare two immutable objects by identity like > this: I don't mean to be overly-nitpicky here, but it strikes me that the is

Re: [PHP-DEV] Immutability RFC

2016-11-16 Thread David Rodrigues
2016-11-16 11:57 GMT-02:00 Silvio Marijić : > If we treat those objects as values then this should return true. But then > again there might be some confusion because then two operators are doing > the same thing. Maybe throw an error ? Suggestions ? I just thinking about "how it will be done"? I

Re: [PHP-DEV] Immutability RFC

2016-11-16 Thread Silvio Marijić
Hi Stepehen, Since immutable objects doesn't have identity, I'm wondering what would be best to do in this case when we try to compare them by identity. Cheers 2016-11-16 15:51 GMT+01:00 Stephen Reay : > Hi Silvio, > > I don’t see why this wouldn’t simply return false? > > Cheers, > > Stephen >

Re: [PHP-DEV] Immutability RFC

2016-11-16 Thread Stephen Reay
Hi Silvio, I don’t see why this wouldn’t simply return false? Cheers, Stephen > On 16 Nov 2016, at 20:57, Silvio Marijić wrote: > > Hi, > > To anyone who is interested in this RFC. What do you think what behavour we > should have when you try to compare two immutable objects by identity like

Re: [PHP-DEV] Immutability RFC

2016-11-16 Thread Silvio Marijić
@Ryan which is existing behaviour in language. Because object is immutable I don't think we should care anymore about 'references' instead maybe we could focus on value that object represents. 2016-11-16 15:29 GMT+01:00 Ryan Pallas : > > > On Wed, Nov 16, 2016 at 6:57 AM, Silvio Marijić > wrote:

Re: [PHP-DEV] Immutability RFC

2016-11-16 Thread Ryan Pallas
On Wed, Nov 16, 2016 at 6:57 AM, Silvio Marijić wrote: > Hi, > > To anyone who is interested in this RFC. What do you think what behavour we > should have when you try to compare two immutable objects by identity like > this: > > immutable class A { > > public $a; > > public function __construct(