Re: [PHP-DEV] Improving PHP's Object Egonomics: A broad analysis

2020-03-22 Thread Mike Schinkel
> On Mar 22, 2020, at 8:47 PM, Larry Garfield wrote: > https://hive.blog/php/@crell/improving-php-s-object-ergonomics Hi Larry, That is a really excellent writeup. Thanks from me at least for taking the time to write it up in depth. Looking at your conclusion, my gut feelings tell me your con

Re: [PHP-DEV] Improving PHP's Object Egonomics: A broad analysis

2020-03-22 Thread Michał Brzuchalski
Hi Larry, pon., 23 mar 2020, 01:48 użytkownik Larry Garfield napisał: > Hi folks. > > There have been a lot of RFCs and possible RFCs of late that are all > circling around the same related problem space: Working with objects right > now involves too much boilerplate to get things done. As I've

Re: [PHP-DEV] Improving PHP's Object Egonomics: A broad analysis

2020-03-22 Thread Levi Morrison via internals
> In short: I believe our biggest potential win is to focus on 3 RFCs: > > * Constructor Promotion I would vote yes on this, assuming the implementation is sane. > * Named parameters This one is tricky -- there are tradeoffs of every approach I've seen proposed. I have an idea for another way to a

[PHP-DEV] Improving PHP's Object Egonomics: A broad analysis

2020-03-22 Thread Larry Garfield
Hi folks. There have been a lot of RFCs and possible RFCs of late that are all circling around the same related problem space: Working with objects right now involves too much boilerplate to get things done. As I've mentioned several times, I believe we need to be looking for broader solutions

Re: [PHP-DEV] is_literal() + WordPress

2020-03-22 Thread Mike Schinkel
> On Mar 22, 2020, at 7:14 PM, Craig Francis wrote: > > On Sun, 22 Mar 2020 at 19:11, Mike Schinkel wrote: >> IMO getting that in WordPress core is highly unlikely > > Good point, like all systems, WordPress will need to consider older versions > of PHP. > > But, because this is a new functio

[PHP-DEV] Re: [RFC] is_literal()

2020-03-22 Thread Mike Schinkel
> On Mar 22, 2020, at 7:14 PM, Craig Francis wrote: > > On Sun, 22 Mar 2020 at 19:11, Mike Schinkel wrote: >> [...] hash out potential solutions on the list rather than propose a >> specific one in advance. > > As to your idea of a "safe" MySQL class, fortunately mysqli already stops > multip

Re: [PHP-DEV] Making mysqli easier to use with parameters

2020-03-22 Thread Craig Francis
On 22 Mar 2020, at 15:28, Levi Morrison wrote: > applying the ids array as `...` will handle the by-reference passing. That does help, thanks. But I still wonder if the ability to pass in a single array of parameters to `$statement->execute()` would remove a step, and be a bit easier to use f

Re: [PHP-DEV] is_literal() + WordPress

2020-03-22 Thread Craig Francis
On Sun, 22 Mar 2020 at 19:11, Mike Schinkel wrote: > IMO getting that in WordPress core is highly unlikely Good point, like all systems, WordPress will need to consider older versions of PHP. But, because this is a new function, they can avoid that issue by using `function_exists()`, as in..

[PHP-DEV] [RFC] is_literal()

2020-03-22 Thread Craig Francis
On Sun, 22 Mar 2020 at 19:11, Mike Schinkel wrote: > I think it would be better to specify the problem(s) you are trying to solve Thanks for your thoughts Mike, I've updated the RFC, tweaking the definition of a literal, and moving that to the end of the introduction, so the problems are now

Re: [PHP-DEV] Are PECL modules preferable?

2020-03-22 Thread Rowan Tommins
On 21/03/2020 22:52, Mike Schinkel wrote: On Mar 21, 2020, at 5:59 PM, tyson andre wrote: FROM: Re: [PHP-DEV] [RFC] is_literal() And if it can be implemented as a PECL module, that would be more preferable to me than a core module of php. If it was in core, having to support that feature may

Re: [PHP-DEV] Are PECL modules preferable?

2020-03-22 Thread Levi Morrison via internals
> IMO, PECL is an antiquated system that needs a successor, in much the same > way Composer is the successor to PEAR. I think there are folks working on a > solution for this, but I’m not sure where they are in their efforts. If we > could make extensions as easy to package, distribute, and inst

Re: [PHP-DEV] [RFC][DISCUSSION] throw expression

2020-03-22 Thread Matthew Brown
I think this is great. It reminds me of a construct that Hack introduced called "as expressions": With throw expressions the Hack assignment, `$a = $b as string;` would be equivalent to the PHP assignment `$a = is_string($b) ? $b : throw new TypeError('$b must be a string');` If this passes,

Re: [PHP-DEV] Are PECL modules preferable?

2020-03-22 Thread Mike Schinkel
> On Mar 21, 2020, at 7:15 PM, Ben Ramsey wrote: > >> On Mar 21, 2020, at 17:52, Mike Schinkel wrote: >> >>> On Mar 21, 2020, at 5:59 PM, tyson andre wrote: >>> FROM: Re: [PHP-DEV] [RFC] is_literal() >>> >>> And if it can be implemented as a PECL module, that would be more >>> preferable to

Re: [PHP-DEV] [RFC][DISCUSSION] throw expression

2020-03-22 Thread Mike Schinkel
> On Mar 22, 2020, at 2:39 PM, Ilija Tovilo wrote: > > Hi Mike > > Thanks for your feedback! > > Your solution works well and it's true that PHP would do just fine without > accepting this RFC. > However I do think this RFC makes sense for a few reasons: > > * I think that most people would e

Re: [PHP-DEV] Are PECL modules preferable?

2020-03-22 Thread Mike Schinkel
> On Mar 21, 2020, at 7:15 PM, Craig Francis wrote: > > On Sat, 21 Mar 2020 at 22:53, Mike Schinkel wrote: > A large number of PHP users have no control over the platform they run on, so > the option to use PECL modules is a non-starter for them. > > > Thanks Mike, > > Personally I agree, I

Re: [PHP-DEV] [RFC][DISCUSSION] throw expression

2020-03-22 Thread Ilija Tovilo
Hi Mike Thanks for your feedback! Your solution works well and it's true that PHP would do just fine without accepting this RFC. However I do think this RFC makes sense for a few reasons: * I think that most people would expect some of the examples (especially the arrow function) to be valid P

Re: [PHP-DEV] [RFC][DISCUSSION] throw expression

2020-03-22 Thread Ilija Tovilo
Hi Dan Interesting suggestion. I'll have to think more about how many of these variations there are and if there's an easy way to recognize them. Ilija On 22.03.20, 18:16, "Dan Ackroyd" wrote: On Sun, 22 Mar 2020 at 16:17, Ilija Tovilo wrote: > > Due to the modest feedback I’d l

Re: [PHP-DEV] [RFC][DISCUSSION] throw expression

2020-03-22 Thread Mike Schinkel
> On Mar 22, 2020, at 1:16 PM, Dan Ackroyd wrote: > > On Sun, 22 Mar 2020 at 16:17, Ilija Tovilo wrote: >> >> Due to the modest feedback I’d like to move the throw expression RFC to >> “under discussion”. >> >> https://wiki.php.net/rfc/throw_expression >> > > Regarding the example: > > $co

Re: [PHP-DEV] [RFC][DISCUSSION] throw expression

2020-03-22 Thread Dan Ackroyd
On Sun, 22 Mar 2020 at 16:17, Ilija Tovilo wrote: > > Due to the modest feedback I’d like to move the throw expression RFC to > “under discussion”. > > https://wiki.php.net/rfc/throw_expression > Regarding the example: $condition || throw new Exception('$condition must be truthy') && $conditi

[PHP-DEV] [RFC][DISCUSSION] throw expression

2020-03-22 Thread Ilija Tovilo
Hi everybody! I hope you’re doing well. Due to the modest feedback I’d like to move the throw expression RFC to “under discussion”. https://wiki.php.net/rfc/throw_expression In short, the RFC proposes to convert the throw statement into an expression to make it usable in arrow functions,

Re: [PHP-DEV] Making mysqli easier to use with parameters

2020-03-22 Thread Levi Morrison via internals
> > $in_sql = implode(',', array_fill(0, count($ids), '?')); > > $sql = 'SELECT id, name FROM user WHERE id IN (' . $in_sql . ')'; > > if ($statement = $db->prepare($sql)) { > > $params = [str_repeat('i', count($ids))]; > foreach ($ids as $key => $value) { >

[PHP-DEV] Making mysqli easier to use with parameters

2020-03-22 Thread Craig Francis
Hi, Considering many new developers don't use a database abstraction, and instead copy/paste mysqli_query() examples. I'm just wondering, is there a way we can make it easier to use parameterised queries? Some initial thoughts below. Craig Take this semi-complex case, in that it's looki