« first day (3454 days earlier)      last day (1494 days later) » 
00:00 - 20:0020:00 - 00:00

8:00 PM
And any callable that isn't single-parameter is just an error, go away.
 
ugh
 
I'm confused by your iterable of callables
 
Let's not do that...
Just combine trivial |> with a $$ syntax for partial function application and you'll get something powerful and coherent
 
@Girgias If you have a code-time list of callables, then $result = $a |> $call1 |> $call2 |> $call3 is fine. But that doesn't work if you want the callables to be defineable at runtime (eg, via configuration).
@NikiC Let's not do which part? Sara's original patch used the $$ placeholder, but I'd rather not, frankly. That seems uncommon from other languages I've seen.
And I don't know how we can do bind operations any other way without type classes, and I am so so so not going there. :-)
 
Oh talking of $$, what are actual use cases for it?
I never managed to come up with one
 
8:02 PM
@Crell If you play your cards right, $$ is just partial application syntax, while |> works on plain callables
Both parts are independent
 
@NikiC Not sure I follow there? You're suggesting foo(5, $$) is a shorthand for fn($x) => foo(5, $x); ?
 
@Crell yes
Or foo(5, ?) or similar
 
@Girgias The only time it was suggested IIRC was in Sara's original pipe operator patch, as a way to handle multi-parameter function in a chain of pipes. Basically what we're talking about here.
:thinking face emoji:
 
@Crell but variable variables already exist in PHP
 
8:04 PM
But I never could come up with a use case for them
 
So then: $a |> $callable |? strlen($$) |> [$obj, 'methodName']; ?
That... I could be comfortable with that, if we're OK with yet another way to define an anonymous function. :-)
@Girgias Oh, variable variables in general? I've not used them since 1999, and I am a better person for it. I think they were originally a cute side effect of the engine, not a deliberate feature. (Though only Rasmus knows for sure.)
 
@Crell yeah, when I was talking with some CompSci peeps at Uni I was telling them about this "feature" and none of us could come up with a use case for them
 
@Crell I'm overall pretty ambivalent about |> given how uncommon use of free functions is in PHP
 
@NikiC So that would also allow for any random line to do $c = some_func(5, ??); as an alternate syntax for $c = fn($x) => some_func(5, $x); Which... I mean, I'd be OK with, but do you think people will be in general?
 
@Crell Part of the appeal is actually to use some_func(...) as the generic syntax for acquiring callables :)
 
8:08 PM
Fair.
 
That is, the replacement for 'some_func' and [$this, 'someMethod']
 
And currying to a single parameter function is by far the most common use case.
I am definitely going to need help with this, as it's way out of my knowledge area...
What are your thoughts on the iterable and __pipe() parts?
(I don't even know how the parser would be able to determine that foo(5, 6, 7, 8, $$) is a closure definition.)
 
I improvised the |> using short closures, they make it a lot neater than what was possible
chain(
  fn() => foo(),
  fn($x) => bar(1, 2, $x),
  fn($x) => foobar("hello", $y)
);
 
@MarkR Me too. The book I have being edited right now makes heavy use of them. :-) I'm trying to make the whole experience even nicer. And I think |> (with the iterable and __pipe() parts) would solve about half the functional programming clunkiness in PHP.
Hm. And... allowing free-use of $$ to make closures would almost remove the need for funcName::name or similar syntax, wouldn't it? Because you can turn the function into a closure so easily...
 
A few weeks ago I played about with adding new logic to the get constant opcode, where if there wasn't an existing constant, but there was a function named by it, it would return a closure of that function... but to do it properly would require unifying symbol tables and that's a much bigger, breakier job
 
8:16 PM
@Crell -1 on iterable (wrap that logic in a function!), I didn't catch what __pipe() is supposed to do
 
__pipe() would be an operator overload. If present on the parameter being passed in, call that instead with the rhs. So:

new Maybe(5) |> $func |> $other |> $blah;

Would call Maybe::__pipe($func);

Which gives us a bind() operation for monads without having to mess with type classes, pattern matching, etc.
(Give or take specific syntax.)
 
@Crell not a fan
 
Pourquoi?
 
That makes the meaning ... overloaded :)
If the operator overloading RFC were passing, maybe :)
 
Yeah, one reason I'm torn on that RFC. ;-)
 
8:21 PM
But given that |> is otherwise a super trivial syntax transformation, I don't think I would want this operator to be overloadable in any case
 
But even without full operator overloading, it seems the natural way to do bind(). The alternative is to use a totally different operator for bind(), and require that the variable provided have a certain method defined. (__bind() or whatever).
 
Not a problem worth solving, from my perspective
 
Why?
 
Because PHP is not the right target for hard-core functional programming
 
I really like $a |> $b being a simple transform into $b($a). Combined with partial function application it would be great. I don't know the optimizer at all, but it can probably be optimized to not actually make closures and such in some cases.
 
8:23 PM
/me notes that $x |> $iterable also becomes a form of reduction, which is... interesting.
@NikiC I disagree. With short closures, I am finding that it's surprisingly close to it. Hence the book I have coming out soon.
 
If a maybe monad is all you want, you can have a fairly ergonomic interface without special syntax, see e.g. Option in rust
 
Right, that's what I'm doing now for the book. But if we have a function concat operator, then a monadic concat seems the next logical step.
 
Main problem to do function programming in PHP are the array functions... okay maybe not the main problem but a big pain point
 
@Girgias Yes. That's the other half of the problem space, but I'm ignoring that for now. :-)
 
I did do a small library to actually make it sane
 
8:28 PM
@LeviMorrison Are you planning to continue that RFC? Because it would dovetail nicely with |> and mean I can just require a single param callable and be done with it, as planned.
 
@Crell I would like to, but I do not have time.
The next step is implementing it to ensure the design actually works.
I'm not going to waste time on the ML without an implementation.
 
Agreed on the last point. :/ I guess asking if you want to mentor me on |> is a no-go then...
 
I have other things for PHP 8 I have to work on. The instrumentation API, internal zend exceptions API, cleaning up our static inline functions, exporting curl headers, and on and on.
Since I work on a PHP ext for my job now I shifted my priorities to making extension authoring better.
 
Logical.
 
If you are feeling adventurous, I'd ask Nikita for an implementation strategy and then try and follow that.
 
8:35 PM
I barely comprehend anything I see in php-src at this point. :-) I'll take any help I can get on either/both RFCs.
 
|> should be able to be entirely implemented in the parser/compiler, which makes for an easier implementation than partial function application.
 
Anthony was pointing me at some places in the source last night, but I still don't fully grok what's going on.
 
What is up with all the voting tables in compact object property assignments :P
> There are yet no patches nor tests. The question of who will be developing this will be addressed if the RFC passes.
Glorious \o/
 
Yeah, I didn't see that line until I was looking at the voting table. I want to not do that. :-)
 
Just call yourself an "idea-man"
 
8:48 PM
@PeeHaa just add an empty section inbetween them
 
@Kalle And accidentally remove the last two voting widgets?
I see what you are doing. nice
:P
 
kek
You are soft my friend, I would just have removed the whole thing
 
:D
 
I do think cosmetic changes like that is perfectly fine, similar to how others also correct typos etc
 
Wes
\o
 
8:58 PM
@Wes YOU LIVE
 
9:08 PM
@Wes o/ Nice to see you around!
5
 
o/
@Wes WES! How are you, man?
Are you one of the ones singing from your balcony? Need video if so. =P
 
@Crell ^^
 
Yay!
 
9:24 PM
@Wes o/
Welcome stranger!
@Kalle Not sure whether removing the whole thing is a cosmetic change
:P
Actually it just might be
 
I think it's good to have the "why not" poll question in there. The whole RFC is a bad idea, but that's a different matter.
 
If somebody wanted to say why not they can already do it by mail if they want imo
 
9:47 PM
@PeeHaa we should just have reactions...
 
lol perfect
make it so?
Isn't their some plugin for that
!!google poop plugin wiki
yeah should have expected that...
5 messages moved to Trash can
 
cmb
the DokuWiki doodle plugin is already patched; thus, make it so! :)
 
@PeeHaa hey, that's my password!
 
:P
 
10:02 PM
@Derick if you would be so kind, can I get your thoughts on: 1) loosening the signature to DateInterval::__construct(string $spec = 'PT0S') (i.e. making arg optional defaulting to an "empty" interval) and 2) adding a DateInterval::$u property which exposes the usecs element as an int.
I regularly find myself writing a lot of boilerplate to manage the $f property to/from int, it would be nice to get rid of it. Technically it would also save a bit of CPU time, but obv not in any actually significant way.
The ctor signature is just because in the case that I am constructing an interval with a fractional part from components, I would rather do $i = new DateInterval; $i->h = 1; $i->m = 15; ... than use a spec string for everything except the fractional part and then set that afterwards, simply from a consistency PoV.
related but separate, I'd also like to have sleep() and stream_select() (amongst others) accept instances of DateTimeInterface and DateInterval to specify their timeouts, which (imho) would be much more user friendly if DateInterval::$u existed
 
@DaveRandom hmm, I guess I imagined DateInterval supporting fractions like PT0.123S
 
afaik it doesn't, and since it's based on ISO8601 it would be highly questionable to add non-standard stuff
tbh my real issue is that working with fractions of a second as floats is a pita
not as a fundamental concept, but almost nothing that deals with timeouts (sleep(), I/O functions) works like that so you end up doing a lot of juggling
 
10:19 PM
Object typehint sometimes seems to be misunderstood ・ Class/Object related ・ #79440
 
10:51 PM
Does this bug still apply? bugs.php.net/bug.php?id=49638
 
11:48 PM
Segfault in mb_chr() if internal encoding is unsupported ・ mbstring related ・ #79441
 
00:00 - 20:0020:00 - 00:00

« first day (3454 days earlier)      last day (1494 days later) »