Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-23 Thread Hendra Gunawan
le{radius: "10"}; ``` ~ 4 of the 8 points I discussed above are related to range pattern and regex pattern. Both are used daily. From my point of view, literal pattern is no more special than range pattern and regex pattern. IMO, both should be placed in Core patterns section, not in Possible patterns section. Regards, Hendra Gunawan.

Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-23 Thread Hendra Gunawan
and regex pattern. Both are used daily. From my point of view, literal pattern is no more special than range pattern and regex pattern. IMO, both should be placed in Core patterns section, not in Possible patterns section. Regards, Hendra Gunawan.

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-15 Thread Hendra Gunawan
> Secondary votes are generally discouraged. I can see the argument for > wanting a short-short version of set, given how common the validation use > case is, but => is almost universally the "evaluates to" symbol, so using > that for a set operation rather than get just feels weirdly

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-15 Thread Hendra Gunawan
> (Also, when replying, please please remove duplicate names from the to/cc > line. I just got double copies of everything in this thread this morning. > I'm on the list, I don't need to be CCed.) Sorry about that. Not my habit before. > For the second, the problem with omitting the {} is

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-15 Thread Hendra Gunawan
> If there is no forward compatibility consideration, can we simplify > interface definition to this one? > ``` > interface IFace > { > public string $readable; > public string $writeable; > public string $both; > } > ``` After carefully reading the proposal again, I think I know the answer

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-15 Thread Hendra Gunawan
> ```php > class User { > private string $first; > private string $last; > public string $fullName { > get => $this->first . ' ' . $this->last; > set => [$this->first, $this->last] = explode(' ', $value, 2); > } > > public function __construct($this->fullName)

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-15 Thread Hendra Gunawan
of functionality in one package. > > https://wiki.php.net/rfc/property-hooks > > -- > Larry Garfield > la...@garfieldtech.com Hi Larry Can the engine detect these logical errors? ``` public string $fullName = "hendra gunawan" => $this->first . " " . $th

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-14 Thread Hendra Gunawan
On Tue, May 9, 2023 at 4:38 AM Larry Garfield wrote: > > Ilija Tovilo and I would like to offer another RFC for your consideration. > It's been a while in coming, and we've evolved the design quite a bit just in > the last week so if you saw an earlier draft of it in the past few months, I >

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-14 Thread Hendra Gunawan
On Tue, May 9, 2023 at 4:38 AM Larry Garfield wrote: > > Ilija Tovilo and I would like to offer another RFC for your consideration. > It's been a while in coming, and we've evolved the design quite a bit just in > the last week so if you saw an earlier draft of it in the past few months, I >

Re: [PHP-DEV] [RFC] Property hooks, nee accessors

2023-05-14 Thread Hendra Gunawan
On Tue, May 9, 2023 at 4:38 AM Larry Garfield wrote: > > Ilija Tovilo and I would like to offer another RFC for your consideration. > It's been a while in coming, and we've evolved the design quite a bit just in > the last week so if you saw an earlier draft of it in the past few months, I >

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-07 Thread Hendra Gunawan
> > And if you want to map, reduce, or filter without grouping? Then you can't > really use this function. And as noted, the order in which you apply those > operations may matter, and no order is necessarily more obvious or beneficial You can modify it slightly if you eager to: array_group(

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hendra Gunawan
g, and the last do reducing. (less common to me) OR: do sorting, then do filtering, then do grouping, and the last do reducing. Best Regards Hendra Gunawan. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hendra Gunawan
> > Better map/filter/reduce primitives in PHP would be dandy, but they have > nothing to do with array grouping. They're a separate operation that should > be composed with grouping. Packing them all into a single function sounds > like a terrible idea. > > If we wanted that... that's called list

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hendra Gunawan
23, "ward4" => 234, ], ... ]; $wQ1 = [ "district1" => [ "ward1" => 123, "ward2" => 234, ], "district2" => [ "ward3" => 123,

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-06 Thread Hendra Gunawan
t($sexGroup["male"]); } } Not a perfect solution, but at least your code is reduced. Best Regards Hendra Gunawan. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] RFC [Discussion] array_column results grouping

2021-12-04 Thread Hendra Gunawan
int|string|array $index_key, callable $reducer = null ) // callable signature fn (array|object $item, int|string $index, mixed $cummulative): mixed note: - $index_key can be in the form `["education", ...]` or `"education"`. - or even `[0

Re: [PHP-DEV] [RFC] Deprecate dynamic properties

2021-08-25 Thread Hendra Gunawan
function __get($name) { // Will get called on first access, but once initialized. $this->groups = ...; } } Regards, Hendra Gunawan. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-28 Thread Hendra Gunawan
bject date back to before PHP 7.0. Is there any consideration why scalar object was not escalated to the next phase, say to RFC? Regards Hendra Gunawan. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-26 Thread Hendra Gunawan
Hello. > > Yes, but Nikita wrote this note about technical limitations at the bottom of > the repo README: > > Due to technical limitations, it is not possible to create mutable APIs for > primitive types. Modifying $self within the methods is not possible (or > rather, will have no effect, as

Re: [PHP-DEV] A little syntactic sugar on array_* function calls?

2021-05-25 Thread Hendra Gunawan
lution while "->" would do > exactly what people want. Not so poor if we * use "~>" as pipe operator rather than "|>" * redesign the api under their proper namespace and strictly place the "haystack" as the first function argument. Regards, Hendra Gunawan. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Property accessors

2021-05-16 Thread Hendra Gunawan
aits), but only the function body and the visibility is overridden based on accessors definition. Regards, Hendra Gunawan.

Re: [PHP-DEV] [RFC] Property accessors

2021-05-07 Thread Hendra Gunawan
e function guard2(): void {/* ... */} private function commonGuard(): void {/* ... */} } I hope that "guard" can be included again. I don't understand the internals of PHP VM. I think the mechanism of this is compiler assisted copy-paste (same as traits), but only the function b