On Wed, Feb 3, 2021, at 8:14 AM, Nikita Popov wrote:
> On Mon, Dec 28, 2020 at 9:24 PM Larry Garfield
> wrote:
>
> > There's been a number of discussions of late around property visibility
> > and how to make objects more immutable. Since it seems to have been
> > well-received in the past, I
> On Feb 3, 2021, at 9:14 AM, Nikita Popov wrote:
>
> On Mon, Dec 28, 2020 at 9:24 PM Larry Garfield
> wrote:
>
>> There's been a number of discussions of late around property visibility
>> and how to make objects more immutable. Since it seems to have been
>> well-received in the past, I
Le 03/02/2021 à 15:14, Nikita Popov a écrit :
I've written up an initial draft for property accessors at
https://wiki.php.net/rfc/property_accessors, but once again I get the
distinct impression that this is adding a lot of language complexity, that
is possibly not justified (and it will be
On Mon, Dec 28, 2020 at 9:24 PM Larry Garfield
wrote:
> There's been a number of discussions of late around property visibility
> and how to make objects more immutable. Since it seems to have been
> well-received in the past, I decided to do a complete analysis and context
> of the various
On Sat, Jan 9, 2021, at 7:24 PM, G. P. B. wrote:
> On Sun, 10 Jan 2021 at 00:33, Larry Garfield wrote:
> > It took a few days, but I am back with some more concrete examples. I
> > decided to try and convert PSR-7 to the various options considered in my
> > previous post. Here are the results:
On 10 January 2021 01:24:38 GMT+00:00, "G. P. B."
wrote:
>Moreover, asymmetric visibility does not prevent mutating an object by
>calling the constructor once again as follows:
>$obj->__construct(...$args);
That's pretty trivial to work around: mark the constructor private and provide
one or
On Sun, 10 Jan 2021 at 00:33, Larry Garfield wrote:
> On Sun, Jan 3, 2021, at 11:29 AM, Olle Härstedt wrote:
>
> > > I'll disagree slightly. A language feature should introduce more
> power than
> > > it does complexity. Not everything *can* be made absolutely simple,
> but the
> > > power it
On Sun, Jan 3, 2021, at 11:29 AM, Olle Härstedt wrote:
> > I'll disagree slightly. A language feature should introduce more power than
> > it does complexity. Not everything *can* be made absolutely simple, but the
> > power it offers is worth it. I'd say it should minimize introduced
> >
2021-01-03 16:55 GMT, Larry Garfield :
> On Sun, Jan 3, 2021, at 8:28 AM, Olle Härstedt wrote:
>
>> >> I like that you connect higher level design patterns with language
>> >> design. This is the way to go, IMO. Personally, I'd prefer support for
>> >> the Psalm notation `@psalm-readonly`, which
On Sun, Jan 3, 2021, at 8:28 AM, Olle Härstedt wrote:
> >> I like that you connect higher level design patterns with language
> >> design. This is the way to go, IMO. Personally, I'd prefer support for
> >> the Psalm notation `@psalm-readonly`, which is the same as your
> >> initonly. Clone-with
2021-01-02 16:06 GMT, Larry Garfield :
> On Fri, Jan 1, 2021, at 5:51 PM, Olle Härstedt wrote:
>
>> >> The web dev discourse is
>> >> one-sided with regard to immutability,
>> >
>> > Yes, if you've heard any of the regular whining about PSR-7 being an
>> > immutable object you'd think it's
On 2 January 2021 21:25:08 GMT+00:00, Larry Garfield
wrote:
>If a stream is not seekable, then it would have to consume and destroy
>$fp in the process (unset it). So:
>
>[$line1, $fp2] = read_line($fp);
>[$line2, $fp2] = read_line($fp);
>
>The second line would throw an error that $fp "has
Hi Rowan and all,
I apologize in advance for the wall-of-text; the short questions lead to long
answers.
> On Jan 2, 2021, at 12:56, Rowan Tommins wrote:
>
> On 01/01/2021 20:31, Paul M. Jones wrote:
>
>> The complaints against the incomplete and inconsistent immutability of PSR-7
>> have
2021-01-02 21:25 GMT, Larry Garfield :
> On Sat, Jan 2, 2021, at 12:56 PM, Rowan Tommins wrote:
>> On 01/01/2021 20:31, Paul M. Jones wrote:
>> > The complaints against the incomplete and inconsistent immutability of
>> > PSR-7 have merit.
>>
>>
>> The big mistake of PSR-7, in my view, is mixing
On Sat, Jan 2, 2021, at 12:56 PM, Rowan Tommins wrote:
> On 01/01/2021 20:31, Paul M. Jones wrote:
> > The complaints against the incomplete and inconsistent immutability of
> > PSR-7 have merit.
>
>
> The big mistake of PSR-7, in my view, is mixing immutable objects with
> streams, which are
On 01/01/2021 20:31, Paul M. Jones wrote:
The complaints against the incomplete and inconsistent immutability of PSR-7
have merit.
The big mistake of PSR-7, in my view, is mixing immutable objects with
streams, which are inherently mutable/stateful. I wonder if there are
any lessons to be
On 31/12/2020 14:04, Olle Härstedt wrote:
Yes, of course you can find use-cases where immutability is a better
choice, just like I can find use-cases where (constrained) mutability
is better. The point is not to replace one tool with another, but
rather adding another tool to the toolbox. The
On Fri, Jan 1, 2021, at 5:51 PM, Olle Härstedt wrote:
> >> The web dev discourse is
> >> one-sided with regard to immutability,
> >
> > Yes, if you've heard any of the regular whining about PSR-7 being an
> > immutable object you'd think it's one-sided in favor of mutability. ;-)
> >
> > As you
2021-01-01 19:14 GMT, Larry Garfield :
> On Thu, Dec 31, 2020, at 8:04 AM, Olle Härstedt wrote:
>> 2020-12-31 12:37 GMT, Rowan Tommins :
>
>> > On 30/12/2020 18:42, Olle Härstedt wrote:
>> >>> To put it a different way, value types naturally form*expressions*,
>> >>> which mutable objects model
> On Jan 1, 2021, at 13:14, Larry Garfield wrote:
>
>> The web dev discourse is one-sided with regard to immutability,
>
> Yes, if you've heard any of the regular whining about PSR-7 being an
> immutable object you'd think it's one-sided in favor of mutability.
To characterize it as
On Thu, Dec 31, 2020, at 8:04 AM, Olle Härstedt wrote:
> 2020-12-31 12:37 GMT, Rowan Tommins :
> > On 30/12/2020 18:42, Olle Härstedt wrote:
> >>> To put it a different way, value types naturally form*expressions*,
> >>> which mutable objects model clumsily. It would be very tedious if we had
>
2020-12-31 12:37 GMT, Rowan Tommins :
> Hi Mike and Olle,
>
>
> On 31/12/2020 00:24, Mike Schinkel wrote:
>> A different perspective is that "withX" methods require a mental
>> translation where "addX" methods do not, much like how a person whose
>> native language is English will find it a
Hi Mike and Olle,
On 31/12/2020 00:24, Mike Schinkel wrote:
A different perspective is that "withX" methods require a mental translation where "addX"
methods do not, much like how a person whose native language is English will find it a challenge to (or
cannot) "think" in French.
I wonder
> 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):
>>
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
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
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
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
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
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,
>
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);
>
> > 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
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
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):
>>
>> ```
>> //
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):
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();
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
>>
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
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
similar as in JavaScript or OCaml? They could
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
to immutability. I think methods like `withX` is an
Am 28.12.20 um 21:23 schrieb Larry Garfield:
There's been a number of discussions of late around property visibility and how
to make objects more immutable. Since it seems to have been well-received in
the past, I decided to do a complete analysis and context of the various things
that have
2020-12-29 15:38 GMT, Larry Garfield :
> On Tue, Dec 29, 2020, at 2:26 AM, Marc wrote:
>>
>> On 28.12.20 21:23, Larry Garfield wrote:
>> > There's been a number of discussions of late around property visibility
>> > and how to make objects more immutable. Since it seems to have been
>> >
On Tue, Dec 29, 2020, at 2:26 AM, Marc wrote:
>
> On 28.12.20 21:23, Larry Garfield wrote:
> > There's been a number of discussions of late around property visibility and
> > how to make objects more immutable. Since it seems to have been
> > well-received in the past, I decided to do a
2020-12-29 8:26 GMT, Marc :
>
> On 28.12.20 21:23, Larry Garfield wrote:
>> There's been a number of discussions of late around property visibility
>> and how to make objects more immutable. Since it seems to have been
>> well-received in the past, I decided to do a complete analysis and context
On 28.12.20 21:23, Larry Garfield wrote:
> There's been a number of discussions of late around property visibility and
> how to make objects more immutable. Since it seems to have been
> well-received in the past, I decided to do a complete analysis and context of
> the various things that
45 matches
Mail list logo