Re: [PHP-DEV] First-class callable partial application

2023-03-17 Thread Larry Garfield
On Fri, Mar 17, 2023, at 9:45 AM, Larry Garfield wrote: > On Fri, Mar 17, 2023, at 3:54 AM, Michał Marcin Brzuchalski wrote: > >>> As a thought experiment, if we had that syntax and functions that were >>> designed to be used with them, it would look like so: >>> >>> function amap(callable $c, iter

Re: [PHP-DEV] Brainstorming idea: inline syntax for lexical (captured) variables

2023-03-17 Thread Larry Garfield
On Thu, Mar 16, 2023, at 6:05 PM, Rowan Tommins wrote: > On 16/03/2023 22:14, Larry Garfield wrote: >> Wouldn't the functionality described boil down to essentially just >> materializing into a few extra lines in the constructor? At least to my >> ignorant non-engine brain it seems straightforwa

Re: [PHP-DEV] First-class callable partial application

2023-03-17 Thread Larry Garfield
On Fri, Mar 17, 2023, at 3:54 AM, Michał Marcin Brzuchalski wrote: >> As a thought experiment, if we had that syntax and functions that were >> designed to be used with them, it would look like so: >> >> function amap(callable $c, iterable $it) { ... } >> function implode(string $sep, iterable $it

Re: [PHP-DEV] [RFC][Vote announcement] Arbitrary static variable initializers

2023-03-17 Thread Tim Düsterhus
Hi On 3/17/23 14:32, Ilija Tovilo wrote: Yes, your example makes more sense. In my old example the value of the static variable was already assigned so didn't prove the point it was trying to make. I adjusted the example in the RFC. Okay, I believe that resolves all the remarks I ha(ve|d). Be

Re: [PHP-DEV] [RFC][Vote announcement] Arbitrary static variable initializers

2023-03-17 Thread Ilija Tovilo
Hi Tim > Isn't the destructor+exception example misleading? In that case the > initial value of '$x' is constant, thus it should always be known to > reflection, no? > > Should the example look like this: > > > function foo($y) { > > $x = new Foo(); > > static $x = $y; > > } > > > > try {

Re: [PHP-DEV] [RFC][Vote announcement] Arbitrary static variable initializers

2023-03-17 Thread Tim Düsterhus
Hi Thank you, I've had another read through the RFC. On 3/16/23 12:51, Ilija Tovilo wrote: Let me know if anything is still unclear. Isn't the destructor+exception example misleading? In that case the initial value of '$x' is constant, thus it should always be known to reflection, no? Sh

Re: [PHP-DEV] First-class callable partial application

2023-03-17 Thread Rowan Tommins
On Fri, 17 Mar 2023 at 09:52, Robert Landers wrote: > > I think this is already supported-ish. For example, here's a partial > application in user space that seems to follow all the rules. Or at > least the rules that are followed make sense. > > function partial(Closure $callable, ...$args): Clo

Re: [PHP-DEV] First-class callable partial application

2023-03-17 Thread Robert Landers
On Thu, Mar 16, 2023 at 11:26 PM Larry Garfield wrote: > > On Thu, Mar 16, 2023, at 4:14 AM, Rowan Tommins wrote: > > On 15/03/2023 21:12, Dan Ackroyd wrote: > >> Would it be desirable to split those two things into two separate > >> RFCs, by having the first RFC not have native syntax support, bu

Re: [PHP-DEV] First-class callable partial application

2023-03-17 Thread Michał Marcin Brzuchalski
Hi Larry, czw., 16 mar 2023 o 23:26 Larry Garfield napisał(a): > On Thu, Mar 16, 2023, at 4:14 AM, Rowan Tommins wrote: > > On 15/03/2023 21:12, Dan Ackroyd wrote: > >> Would it be desirable to split those two things into two separate > >> RFCs, by having the first RFC not have native syntax sup