Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Eugene Sidelnyk
> Please don't top post. This is a bottom-post-centric list. Can you please tell me what mailing client you use and what should I? > if we were designing the language today we would do it very differently. This reminds me working with legacy code in the team which says to write the code in the

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Eugene Sidelnyk
> Having a "readonly" class where the properties are read-only by default makes sense to me, but maybe the better way to do it is with an attribute? We already have such an attribute provided. It is called [`#[Immutable]`]( https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/#immutab

Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-07-16 Thread Craig Francis
On Fri, 16 Jul 2021 at 21:24, Hans Henrik Bergan wrote: > short of a bug in esc_like(), i don't even see the vulnerability issue in > that code? > Sorry Hans, I copied the wrong diff. There were only 2 changes from woocommerce 5.5.0 to 5.5.1. Like you I was wondering what that diff was doing

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Mike Schinkel
> On Jul 16, 2021, at 6:12 AM, Bruce Weirdan wrote: > > On Fri, Jul 16, 2021 at 9:45 AM Eugene Sidelnyk wrote: > >> Readonly properties are really useful for DDD, where everything is going to >> be immutable. It promotes best practices. However for people to use it, >> syntax should be concise

Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-07-16 Thread Hans Henrik Bergan
short of a bug in esc_like(), i don't even see the vulnerability issue in that code? that sanitize call looks like a data corruption issue and i bet it fails to search for binary data, but i don't see the critical vulnerability?

Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-07-16 Thread Craig Francis
On Fri, 16 Jul 2021 at 15:50, Dan Ackroyd wrote: > On Mon, 12 Jul 2021 at 19:57, Craig Francis > wrote: > > > the “go-safe-html” library authors decided that > > "the ergonomics of trusting concatenated constants far outweighs the > security concern". > > Go is a quite different programming lang

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Larry Garfield
On Fri, Jul 16, 2021, at 6:48 AM, Eugene Sidelnyk wrote: > @Nikita Popov I'm not sure what you mean by saying > this: > > > We're always explicit at the declaration site, it's const FOO, function > foo, class Foo etc > > > Regarding your message > > > Here mutability is decided by single $ ch

[PHP-DEV] LGPL Question

2021-07-16 Thread Jordan LeDoux
I'm fairly certain that it is compatible, however I wanted to double check. Can LGPLv3 sources be included with the PHP source or is the PHP License incompatible?

Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-07-16 Thread Dan Ackroyd
On Mon, 12 Jul 2021 at 19:57, Craig Francis wrote: > the “go-safe-html” library authors decided that > "the ergonomics of trusting concatenated constants far outweighs the security > concern". Go is a quite different programming language to PHP. When they say 'constants', they appear to be abl

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Eugene Sidelnyk
@Nikita Popov I'm not sure what you mean by saying this: > We're always explicit at the declaration site, it's const FOO, function foo, class Foo etc Regarding your message > Here mutability is decided by single $ character in the declaration, which doesn't have a particular obvious connectio

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Bruce Weirdan
On Fri, Jul 16, 2021 at 9:45 AM Eugene Sidelnyk wrote: > Readonly properties are really useful for DDD, where everything is going to > be immutable. It promotes best practices. However for people to use it, > syntax should be concise and brief. If every property of the class is readonly it would

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Nikita Popov
On Fri, Jul 16, 2021 at 10:11 AM Eugene Sidelnyk wrote: > Thanks for your response! > Anyway, I probably put it wrong by saying "by default", so let me clarify > myself. > > What I really mean is omitting the dollar sign. So everything remains the > same with ordinary properties (which are mutabl

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread AllenJB
On 16/07/2021 09:11, Eugene Sidelnyk wrote: Thanks for your response! Anyway, I probably put it wrong by saying "by default", so let me clarify myself. What I really mean is omitting the dollar sign. So everything remains the same with ordinary properties (which are mutable), and we introduce

Re: [PHP-DEV] [RFC] [VOTE] is_literal

2021-07-16 Thread Nikita Popov
On Fri, Jul 9, 2021 at 12:23 AM Máté Kocsis wrote: > Hi Nikita, > > I performed a few other benchmarks in order to provide a little bit more > insights into the performance aspect of the RFC. My latest measurement is > using the same setup as the previous > one, although I made a few smaller chan

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Pierre
Le 16/07/2021 à 10:11, Eugene Sidelnyk a écrit : Thanks for your response! Anyway, I probably put it wrong by saying "by default", so let me clarify myself. What I really mean is omitting the dollar sign. So everything remains the same with ordinary properties (which are mutable), and we introdu

[PHP-DEV] Re: [VOTE] First-class callable syntax

2021-07-16 Thread Nikita Popov
On Fri, Jul 2, 2021 at 12:50 PM Nikita Popov wrote: > Hi internals, > > As the partial function application RFC has not been accepted, I have > opened voting on https://wiki.php.net/rfc/first_class_callable_syntax. > The vote closes on 2021-07-16. > The RFC has been accepted unanimously, with 44

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Eugene Sidelnyk
Thanks for your response! Anyway, I probably put it wrong by saying "by default", so let me clarify myself. What I really mean is omitting the dollar sign. So everything remains the same with ordinary properties (which are mutable), and we introduce immutable (readonly) properties as another type

Re: [PHP-DEV] Readonly properties - immutability by default

2021-07-16 Thread Nikita Popov
On Fri, Jul 16, 2021 at 8:45 AM Eugene Sidelnyk wrote: > This is replica of github PR comments: > > Hi there! > Isn't it better to simplify this a bit? I mean `readonly` keyword is really > long to type every time we need such property. Earlier (in php7.3) > properties were defined only with visi