« first day (3071 days earlier)      last day (2102 days later) » 
01:00 - 18:0018:00 - 00:00

18:23
Congrats for the rfc: the quality is incredible.
There is one other variant that could work:
\($x, $y => $x * $y)
also, green is a great colour.
I think that it makes it easier to parse for the eyes than `\($x, $y) => $x * $y` when it's used as a function argument:
`array_reduce(\($acc, $curr => $acc+$curr), $arr, 0)`
Wes
Wes
@ArnaudLeBlanc no, because otherwise you end up with LISP )))))))
that is, if you nest them, on the right side you get a bunch of )))))))
@TheodoreBrown it already has an obvious meaning, [], I think it's well established by now that we can't just use what is used elsewhere, because => already has a meaning, fn coming first makes it easy to understand what follows better than \, which also has meaning for php ...
@JoeWatkins fn() => expr also already has an obvious meaning: 3v4l.org/TNiUb. In contrast the backslash syntax wouldn't be ambiguous or a BC break.
18:37
> Ilija Tovilo analyzed the top 1,000 PHP repositories on GitHub to find usages of fn. The gist provides more information, but the rough findings are that all known existing usages of fn are in tests except one case where it is a namespace segment. (The namespace use happens to be in my own library, and I'm happy to rename it.)
reminds me of an (horrible written) application where the most important object was in a variable called $v. workmate killed it with a foreach(... as ... => $v). We searched at least two hours for the error
for all practical purposes, it does not really have meaning ...
Add preg_match flag to return only offsets – #77744
@JoeWatkins Yeah, I'm not saying that the BC break is a huge issue. :) It's just that either way users will have to learn what the prefix means, and I'd like to save 3 more characters for the common single-parameter case.
I just love short closures
They're the ultimate bikeshed :D
18:43
@TheodoreBrown But fn is easier to search for. "php fn keyword" already leeds to the doc pages for anonymous functions
@Jeeves ha, what does that guy know about performance or scaling PHP?
@kuh-chan "haskell backslash keyword" also leads directly to the Haskell documentation for anonymous functions.
@kelunik I think we should plan for it in PHP 9, emit warnings of some kind in PHP 8 when there are symbol conflicts in other tables.
@TheodoreBrown won't work for php. If your search for this, you'll find a lot of stuff about namespaces.
@kuh-chan Currently, yes. It would be easy enough to add an answer to the top Stack Overflow result, though.
18:53
@NikiC watching the world burn is fun ...
@NikiC bahaha
why not... <$x, $y> => $x * $y; ? :P

tbh - I don't care. I read the update guides and rfcs. But in my opinion fn is more clear
@NikiC I'm fascinated by the amount of buzz around reducing the amount of a few typed keywords
meanwhile, I'm adding generics inside annotations :P
@NikiC The RFC does not discuss $fn = { voidFunc() };, $fn = { => val() };, $fn = { $param => $param + 1 } for closures - any reason why?
18:57
@bwoebi it does in the block syntax section
ah I'm blind thanks
@NikiC Yep.
@NikiC note that for the nested arrow function syntax, this will be mainly single parameters where we can just not use parens as well, don't consider that an argument really that it's "noisy"
it's actually even fewer characters then
with a clearer delimitation where the short closure ends
function array_values_from_keys($arr, $keys) {
  return array_map(λ($x) => $arr[$x], $keys);
}
function array_values_from_keys($arr, $keys) {
  return array_map(λ $x => $arr[$x], $keys);
}
yeah, but with fn this is weird
19:03
I wonder if fn or λ would have more BC breakage...
haha
Not that I am seriously proposing it--just wondering.
At least my current favorite is really the block based syntax, which can be trivially extended to just also include statements and still feel natural
and does not require a "=>" except as a shorthand for return possibly and parameter / value separation
You mean { (params) => expr }?
I didn't quite understand your previous message.
@LeviMorrison We could also do that in 7.4, but 8.0 might also be an option.
19:09
{ params => expr }, yes
the parens feel redundant for that case
Just use Swift's syntax then:
function array_values_from_keys($arr, $keys) {
  return array_map({ $x in $arr[$x] }, $keys);
}
If it's a single expression, then it auto-returns.
If it's not an expression, then it's a block.
Not sure how hard that is to actually implement.
user924016
yooo
@kuh-chan the answer, is in the documentation that the person asking should have read before asking.
hopefully nobody will answer, and the person will read documentation.
20:43
Anyone know what the output of php-config --includes looks like on Windows?
Do they also use -I or ..?
/I maybe?
Unexpected result DateTime::createFromFormat – #77745
21:56
@NikiC That grammar is fundamentally ambiguous, T_YIELD T_ARROW_START expr ')' T_DOUBLE_ARROW expr this obviously conflicts within expr at least… 1 token lookahead is not enough to distinguish it from parameter_list
@bwoebi It conflicts, sure, but we just need it to resolve in favor of the yield
and even if you're shifting, it does shift to what you prefer, but something like yield ($x = 1 + foo()) => $x will give a parse error
ah okay
@bwoebi that shouldn't give a parse error, it should give a yield
yeah got it
I thought we wanted in favor of the short closure
22:11
@bwoebi that would be easy: it's what would happen by default :D
22:23
Evening!
Wes
Wes
happy bday @mega6382 \o/
thanks :)
 
1 hour later…
23:47
@NikiC found no real way … it exposes pretty much the same issue I also had when trying to allow => in the parser directly.
This is where I also failed last time.
01:00 - 18:0018:00 - 00:00

« first day (3071 days earlier)      last day (2102 days later) »