« first day (3868 days earlier)      last day (1087 days later) » 
01:00 - 17:0017:00 - 00:00

1:35 AM
@LeviMorrison not exactly, we have to break the function apart, we have to retain the original function for call time, we have to create a prototype with the appropriate signature and we have to create a trampoline with the signature of the prototype that executes the original function ... the defaults don't move, they are RT_CONSTANT on op2 of the RECV_INIT instruction of the original function ...
 
@JoeWatkins The parameters keep their "defaultness" though?
 
krakjoe@Fiji:/opt/src/php-src$ sapi/cli/php demo.php
Function [ <user> partial function foo ] {
  @@ /opt/src/php-src/demo.php 2 - 4

  - Parameters [2] {
    Parameter #0 [ <required> $baz ]
    Parameter #1 [ <optional> $bar = 10 ]
  }
}
[Wed May 19 03:41:42 2021]  Script:  '/opt/src/php-src/demo.php'
/opt/src/php-src/Zend/zend_partial.h(45) :  Freeing 0x00007fd916a8f078 (8 bytes), script=/opt/src/php-src/demo.php
Last leak repeated 1 time
=== Total 2 memory leaks detected ===
krakjoe@Fiji:/opt/src/php-src$ cat demo.php
no, we have to juggle, and it's not simple, it would be simple, if we could move instructions, but we can't ... like I said all along ...
 
If an argument is marked with ?, I think it should lose the default and become required. I was referring to the variadic case foo(...).
I think Nikita said something like that in passing too, that ones with ? should become required. Matches the 1:1 of ? to Closure parameter.
 
tbh I'm pretty exhausted by this, I think I need to stop, I'm not really enthusiastic about these ideas anymore, I don't agree that supporting named parameters is required, I definitely don't agree that we should be adding another mechanism for function declaration, especially one with such complicated implications ... I'd vote against the thing we're going to end up with here ... I tried to say this over and over ...
 
2:04 AM
nikita may think there are no problems with implementation, but he also hasn't done it, every problem you solve creates another, every other problem you solve adds complexity, and it's becoming unmanageable, for me anyway ... I can't in good conscience propose something that I think is harmful to userland and far too complicated for internals ...
 
2:20 AM
@LeviMorrison @Crell maybe you can get nikita to do an implementation of whatever you end up with, but I gotta say, because I'd vote against the thing being proposed no matter who implements it, I gotta withdraw my involvement here ... sorry ...
 
No worries. Thanks for your work so far!
 
 
3 hours later…
5:13 AM
@Sara no 8.0.7RC1 yet ?
Good Morning mahouts
 
6:09 AM
mornin o/
 
 
2 hours later…
8:05 AM
!!rfcs
 
@MateKocsis You have to do it manually :)
 
Ah, how does it work? :D Nevertheless, I've opened the vote about final class constants: wiki.php.net/rfc/final_class_const
 
@NikiC I can't really figure everything out, everything I solve turns into another problem ... the root problem is that the opening ( not longer means "gradually fill in this call frame in order" - which is what I understand partial application to mean, it means "redeclare the function before )" ... the only way I see out of most of the "details" is replacing INIT opcodes with a handler that does actually rebuild the function ... it's probably not the only option
also, I never said it was impossible ... I said it was impractical in exactly the way I describing ... but whatever you end up with doesn't feel like a win, when this thing we're achieving is actually possible in userland, quite easily ...
 
@JoeWatkins can you share what you have right now?
 
when we were just making first class support for fetching a callable thing from a symbol, that felt like a win, but this doesn't at all ...
 
8:15 AM
@JoeWatkins Well, I've always said that that's the only part I'm really interested in, and I'd be happy to have just that (basically the foo(...) part in the latest proposal, but not necessarily with that syntax). The thing is that if we want to provide that functionality as part of a larger partial function application feature, then the overall semantics need to match what people expect them to be.
 
@SaifEddinGmati Yes, but ... wtf is that syntax
 
> hack
it's in the name :D
 
@JoeWatkins Any thoughts about going back to the roots here and introducing just foo(...) and leaving everything else as future scope?
That would still be forward-compatible with partial functions in the newest iteration
 
yes, I want that, it was the thing I most liked, and also the factory thing that emerged was cool ...
 
8:20 AM
@JoeWatkins Heh, I'm still somewhat skeptical about the factory thing :)
 
Oh, because generics ... https://docs.hhvm.com/hack/functions/function-references#generics

so if `foo` is `function foo<T>(T $bar): T`, and `$bar = foo<string>;`, `$bar` would be `function(string $bar): string`
 
@NikiC I've pushed so you can have a look, most basic examples work ~ish, re-application doesn't work, defaults are all messed up, it's not in a good state ...
@NikiC I'd also be open to disallowing in constructor case ... when it had the same behaviour as calling $object->__construct everyone said that was strange ...
 
8:56 AM
Would someone be kind enough to explain the rationale behind some things like named argument resolving being done on send, and some things such as type checks / defaults being done on receive?
 
How can I make using op_array->reserved[my_ext_index] work with opcache.protect_memory=1 ?
 
9:16 AM
morns
 
9:35 AM
@Derick Use run_time_cache[my_ext_index]
If you want to do runtime modification
 
is that also on op_cache ?
erm
op_array->
 
@Derick yes
behind a ZEND_MAP_PTR_GET
It's also on EX, if you have an execute_data handy
 
thanks.

I have another one, which is the "zend_apply_hash_protection" that I use on zend_class_entry->properties_info ...
I'm not sure why I even do that tbh
 
I'm not sure why do that either :P
 
I'll remove it and see whether tests still work :-þ
@NikiC FWIW, upgrading.internals says about the "reserved" bit to use ZEND_OP_ARRAY_EXTENSION instead
 
9:53 AM
@Derick yes, I thought that's what you're talking about?
 
yeah, but I wasn't using thta yet... and why would I still need that ZEND_MAP_PTR thing then?
 
Ah I see what you mean, yeah, looks like there's a handy macro :)
 
exactly
 
Then you don't need to know the details :)
@Derick I have to admit that I don't know the whole macro surface of Zend :P
 
Blasphemy
 
10:09 AM
@NikiC hmm, I'm now getting crash due to a null ptr dereference when setting ZEND_OP_ARRAY_EXTENSION(o, my_ext_handle) = 0 — as alternative to the old o->reserved[my_ext_handle) = 0 — Am I misunderstanding this API?
Can't find examples of its use in the php-src tree either :-/
newrelic ran into this too: bugs.php.net/bug.php?id=78860
 
@Derick Presumably you're using it at some point where the runtime cache is not initialized yet
 
yes, in the init_oparray handler
 
Are you just setting it to zero there?
If so, don't do that, it's automatically zero
 
yes, just my init value
it's either 0 or 1
 
And you want to later modify that value at runtime?
 
10:17 AM
I'm running the analysis here too, so I do need that runtime cache at this point
yes - i want to change that later
 
@Derick Would calling zend_init_func_run_time_cache help? Though I'm somewhat doubtful it will behave reasonably that early
 
I just did that, but it still crashes
 
Taking a step back here, what are you actually doing? ^^
 
I am using the op array's reserved bits for two things: an integer to check whether code coverage has analysed it in this "loop" of start_coverage/stop_coverage (it increases by one every time you do start_coverage) ; and 2. a flag whether this function/op_array should not be included in code coverage
For the flag, I check the function and store whether it needs to be filtered in the init_oparray zend_extension handler . For the integer value I'm just being nice and setting it to 0 as initialisation in this same handler.
 
10:26 AM
@Derick Okay, I think what would work nicely in that case is to put the flag whether it needs to be filtered into the old reserved slot (as this is immutable) and put the counter in runtime cache, without explicit initialization
 
wouldn't the latter create an uninitialised read then?
 
@Derick No, it is initialized to zero when the runtime cache is created
 
No, that doesn't work either, as I'm doing all the analysis as well before the function is run for the first time
(in fact, all new methods and function in the zend_compile_file handler)
 
@Derick And where does the analysis get stored?
 
Xdebug's globals
 
10:36 AM
Okay, then I don't see the problem with that
You can still run the analysis as usual?
 
Yes, but it only runs if the integer that I meantined as point 1 is higher... and I can't access that integer
 
Uh, doesn't that mean you should be running the analysis the first time you increment that integer (at runtime)?
 
FWIW, it shouldn't need to do that. However, due to historical design decisions, I ...
sorry, shopping is here
 
10:53 AM
FWIW, it shouldn't need to do that. However, due to historical design decisions, I have not split the analysis part and the runtime data collection part, which no means I need to run the analysis still more than once.

It seems however that this is really only a problem with opcache and multiple requests, which isn't something that is used with code coverage.
 
11:10 AM
PDO Sqlite in memory database ignores memory_limit ・ PDO SQLite ・ #81049
 
@NikiC the "analysis" is checking where there is dead code etc. So that needs to run before code is executed.
 
11:38 AM
@DaveRandom they are all coming from jointhe.daverandomlikesmankinis.club and your cell phone number
 
@NikiC Turns out I can't put the filter flag in the original extended array either, as the filter set can change during run time
 
@cmb I thought about github.com/php/php-tasks/issues/29 but I wasn't sure if this task is related to his interests... I'd need these tests because I want to migrate the relevant resources to objects.
 
cmb
well, you can ask him, although I don't think this is what he's looking for. :)
Regarding ext/odbc: I'm not sure whether we should migrate to objects; might be better to unbundle it.
 
@cmb oh sh*t, really? I've already picked it, and already ready with a big part of it :(
 
cmb
well, then proceed :)
 
11:51 AM
@MateKocsis How about DBA then? :P
 
@cmb yeah, probably it's not a big harm, we also did the same with XML-RPC :)
@Girgias I have my fingers crossed that someone beats me to do it ;)
 
@MarkR named arguments are only resolved on the sending side if the function being called is known ... and now I've pointed out that the function needs to be known to resolve names, it's obvious it need to be known to resolve types ... the sending side doesn't have to know anything about the function to be able to construct a call frame, and that's necessary because of the dynamic nature of php ...
 
@MateKocsis Honestly looking into streams might be the best one to tackle, @Sara did you have time to look into that again? I know you had some ideas last year
 
@Girgias Yeah, I agree, but that seems like a more difficult task than what I could handle. Also, didn't we say that streams should only be migrated for PHP 9.0?
 
Don't remember, but yeah streams are a whole mess
 
12:01 PM
Hi all
I am facing an issue for loading instagram images
error am seeing in console is "Failed to load resource: net::ERR_BLOCKED_BY_RESPONSE"
 
cmb
@MateKocsis streams are used by external exts, so there may be a big BC break
 
Morning, all.
 
Also adding to above, when i try to load the image in another tab its getting:
<img src="https://scontent-cdt1-1.cdninstagram.com/v/t51.2885-19/s320x320/176283370_363930668352575_6367243109377325650_n.jpg?tp=1&_nc_ht=scontent-cdt1-1.cdninstagram.com&_nc_ohc=nC7FG1NNChYAX8wSL7_&edm=ABfd0MgBAAAA&ccb=7-4&oh=696d56547f87894c64f26613c9e44369&oe=60AF5A34&_nc_sid=7bff83">
 
12:22 PM
@RahulS if you're wanting help, you need to provide more information, such as a sample of your code. What you've given is too broad.
 
Actually am using a plugin in wordpress and its actually getting the images from instagram account and showing that in a page. It was working fine few days back but when i checked now it seems am getting the above error for all images "Failed to load resource: net::ERR_BLOCKED_BY_RESPONSE" and when i tried to load the image url provided above in new tb its working.
 
@JoeWatkins @NikiC I don't know how far we could pair it back at this point, now that we've identified so many edges. Just adding foo(...) would solve the reference use case, but not the reduce-to-unary case, which is my priority.
 
12:42 PM
@Tiffany ^
 
Maybe the source blocked your site from accessing?
Maybe need an API key or something? Just a guess
What have you googled and what have you tried already?
anyway, back to work, good luck
 
very likely that instagram has the 'x-frame-options' set to 'sameorigin' or something like that
7
Q: Failed to load resource: net::ERR_BLOCKED_BY_RESPONSE

Sunny KaseraI am looking for some solution of this issue of iframe domain.com/:1 Refused to display 'domain.com/?q=node/add/editor' in a frame because it set 'X-Frame-Options' to 'sameorigin'. domain.com/?q=node/add/editor Failed to load resource: net::ERR_BLOCKED_BY_RESPONSE domain.com/:1 Refused to displ...

 
1:08 PM
@Tiffany I tried to update again using api credentials but no luck still the same. I found similar one posted here stackoverflow.com/questions/67279678/…
 
@Crell what exactly do you mean with reference-to-unary case?
 
I should have typed reduce-to-unary, sorry. Typing too fast.
 
@Crell okay, but what exactly is that?
the case where you want exactly one parameter left?
 
Take arbitrary function, fill in all args except one via partial, poof, now it's compatible with anything that expects a single-argument callable. Like, say, the proposed pipe operator.
Correct.
unary function = function with one parameter.
 
@FlávioHeleno seems i saw the x-frame-options as deny
 
1:11 PM
@Crell so, where's the probablem with that? if I followed the discussions, we ended up with 1 ? = 1 param - and thus that's fine?
 
@RahulS that's a "no-go" from instagram for displaying the pictures outside its website afaik
 
@FlávioHeleno do you know from where we can change that?
 
If we're going to pair back the scope to avoid some of the complicated edges, I want to make sure reduce-to-unary is still an easy use case. Nikita wants to protect the "reference an arbitrary function/method without the stupid string or array silliness, but don't fill in any args" case.

Those are the mandatory use cases, in my mind.
 
from nowhere, that's an instagram header, you can't change its response.. but you could do a "proxy" using a php script to get the picture for you @RahulS
 
@FlávioHeleno ok understood
thank you
 
1:15 PM
@Crell I'm confused foo(?) and foo(1, ?, 2) would be simple trivial unary functions? Similarly foo(...) as a function without any filled args?
 
@RahulS :)
 
Parameter binding with functions in WHERE condition does not work ・ PDO_INFORMIX ・ #81050
 
@bwoebi Yes. Read up, Joe's backing out because of the pressure to handle all cases. Nikita said after that he would be happy with just foo(...) and be done with it. I'm saying that's not enough, as we at least also need foo(1, ?, 2) or equivalent.
 
@Crell yeah we should just have what Levi proposed
 
I think that's what Joe is balking at. :-)
 
1:34 PM
Broken property type handling after incrementing reference ・ JIT ・ #81051
 
@Crell I guess he's mostly balking at the ever changing specification
 
Can't say I blame him. :-( Still, we need to figure out some way forward here.
 
cmb
divide & impere! Getting a closure and PFA are different features, and IMHO the former is more important. The latter could be solved later (maybe by a set of methods on Closure).
I would prefer `@$obj->method` or `&$obj->method` instead of `$obj->method(...)`, but this is obviously not possible.
 
How is the former more important?
 
@cmb I think the most elegant will be though to have a common syntax for both
 
1:45 PM
Everything we've discussed can be done manually today using fn().
 
cmb
yep, but that's ugly
 
Oh, by "getting a closure" you mean the "referencing a callable without stupid syntax" use case.
 
cmb
yes
 
That was always a nice-side-benefit of PFA. PFA gives us that mostly for free, but PFA is the goal.
 
Hey folks I'm new to PDO & PHP and I'm using it with react native as my backend, I was wondering if anyone can help me locate the error here.
I'm receiving json parse error: unexpected EOF.
nothing beyond that, no line, no specific error..
https://codepen.io/yotamdahan/pen/QWpGaZe
 
1:48 PM
@Crell I disagree - both should be the goal… and both should have a nice syntax
 
How come when I type over something it deletes the next letter?
 
The RFC is for PFA. It literally says in it that literal references are a nice side effect. :-) You may want to have literal references, I do too, but the RFC's goal was and is PFA.
 
2:04 PM
@BeerusDev press insert in your keyboard
 
cmb
@Crell yeah, but given that the discussion is going round in circles, maybe it's too near-term for 8.1 anyway; and maybe the full power isn't needed; Closure::partial() and ::partialRight() might be sufficient?
 
@Tiffany thanks
 
Not if the goal is a clean and compact syntax. Remember, my interest is in getting pipe through, which was blocked by people finding manual fn() too ugly in this case. Pipe and a PFA give us a really nice FP story.
I had just about come around to Levi's proposal, although I think the wording of it could be improved. Trwoski convinced me of the need to separate the one and many placeholders, because optional arguments are annoying. :-)
 
cmb
Haskellers might disagree, though. :)
 
PHP is never going to be Haskell, and that's a good thing. :-) But compared to other peer languages, PFA and pipe would be a really, really powerful combination.
(Peer languages: Javascript, Python, Ruby, etc.)
 
2:09 PM
@cmb if we have these special partial functions, we just can do ad hoc fn()'s … it's really more about the sugar than the functionality itself
 
cmb
yeah, but how often do you need foo(1, ?, 2)?
 
Right now? Probably not much. In combination with pipes? Probably quite a bit.
 
@cmb the main reason why I don't need it very often is because I search for other ways which avoid the clumsiness of the current possible approaches
 
For me, this is all about enabling things that are currently impractical or infeasible, so rarely done. But making them easier will make them more common. Just like closures technically don't do anything that objects can't. They're "just" sugar over objects. But that sugar is so sweet that it changes how you approach a problem, in good ways.
 
yeah that
 
2:13 PM
Parameter binding with SKIP, FIRST, LIMIT do not work ・ PDO_INFORMIX ・ #81052
 
cmb
@Jeeves nobody fixes PDO_INFORMIX bugs
 
My goal is being able to write:

function foo($a) => $a |> bar(?, 4) |> baz('blah', ?) |> array_map(get_thing(?), ?) |> array_filter(?);
Right now, that's an absurd amount of ugly code. With pipes, PFA, and short functions, that kind of thinking (building pipelines out of trivial functions) becomes trivial, and eventually second nature.
 
@Crell IMHO, Hack's approach for piping seems better to me.
 
@JoeWatkins and @NikiC But how do you copy the signature faithfully?
I thought that was one of the harder bits due to default parameters?
 
@SaifEddinGmati Hack's approach is what Sara originally proposed a few years back, and on which both of these RFCs are based. Effectively, the combination of them gets us hack's syntax but with ? instead of $$, and the ability to use PFA everywhere else, too.
 
2:17 PM
@SaifEddinGmati you mean a magic $$ instead of calling a function with the input?
 
That's why it's 2 RFCs.
 
@bwoebi yes
 
I'd be happy to reduce it down to foo(...) for now due to implementation complexity, but I thought that was one of the hard cases due to default parameters...
 
That would be useless for pipes, so I'm not on board with that.
 
@Crell if i'm allowed to do foo(?, 4, ?) outside pipe operation, why can't i do it in a pipe operation? and what would happen if i do? what if i do bar(foo(?), ?) where i want to actually pass a partial closure to bar as a first argument?
 
2:18 PM
@LeviMorrison foo(...) is essentially equivalent to Closure::fromCallable() … if you want only that, then you could implement that as sugar only
 
Then you'd end up with a 2 param function, where pipe wants one, and if the second is required it will give you the appropriate error.
The lego pieces all fit together nicely.
 
@bwoebi I assumed (perhaps badly) that you can still bind parameters e.g. foo(1, ...)
 
@LeviMorrison I think the difference between ? and ... is not that big when you have either
 
@cmb I just found a marvelous open_basedir bypass: github.com/php/php-src/pull/7015
 
(And the stuff about reordering parameters, I don't care, I am perfectly happy to not have that. It's entirely pointless to me, and I'd just as soon not have it. That's scope creep.)
 
2:21 PM
I think it's limited in scope in that it only works for paths that don't exist, but it still seems like a weirdly basic thing to be broken
 
i don't see them fitting together, that's an error that shouldn't exist in the first place, as i said, this would mean i can't create a partial in a pipe operation, resulting in an error that mentions additional arguments but i have no idea what it means as all i want is to be able to create a partial in there :)

keeping them separated is better. Hacks solution works, and from using hack for over 2 years, i can say it's one of the most consistent things in there ( almost everything went into refactoring at some point except pipe operation ... it just works )
 
@SaifEddinGmati I don't see how it's not a self-evident error. |> wants a unary right hand side. You feed it a non-unary right-hand-side, it breaks. But you can also give it an arbitrary callable and it still works, as long as it's unary (and type compatible).
 
$bar = bar(?, 1);
return foo() |> baz(?, $bar);

i can't remove $bar variable ( inline ), since a new ? in pipe will break it :)
 
it seems nobody is happy to have parameters without named parameters, when we're talking about (...), we're not talking about any parameters being involved at all, like bob said, just sugar, but first class is better than second class, it's a win, for not very much work ... it's probably the only path to someday deprecating the strangeness of callable, or at least reigning it in ...
you can't have named parameters without reordering unless you place restrictions on the implementation that nobody liked either - such as required named parameters and no placeholder support ...
 
If reordering falls out naturally, I'm OK with it, but if it's easier without it, that's also fine. It's the least valuable part of all of this for me.
 
cmb
2:27 PM
@NikiC wow! Should probably be fixed for older versions as well.
 
@NikiC nice finding!
 
reordering isn't impossible, but it's hard, and it totally changes the nature of the feature, it's not partial application anymore, it's redeclaration by the back door ... even if you solve all the problems and find a nice way to do everything, you're still introducing yet another way to declare functions, only this one is totally disjointed, comes with no type information and is so mysterious to figure out that we've been discussing it for a whole month, and still don't agree ...
 
No type information?
 
visually, I mean
this doesn't seem like a big deal when the types are two lines above the partial application, which is the only way any of us have read it so far ... but that is not what we will see in the real world ...
 
Does Levi's latest proposal work for you? If not, why?
 
2:40 PM
if nothin changed in the last few hours, and it still includes named placeholders, then I just explained it ? I'm personally struggling with the implementation, but even if that weren't a problem, I wouldn't like it for the reasons I just stated above ...
 
What if named placeholders were removed? Named arguments kept, but not named placeholders.
 
@Gordon is that a what3words grid ref? seems kinda wordy
 
you can't have named arguments without supporting re-ordering, which is the same problem as named placeholders ... if you're going to support named placeholders, people expect to be able to re-order (naturally) ...
 
@SaifEddinGmati You can do foo(?, 4, ?) in a pipe operations, it's just meaningless because it's an error. I am confident that Hack got this particular thing wrong.
 
Which suits me fine. As I said, reordering is of minimal value to me in all the use cases I can envision, most of which are unary functions or ...
 
2:43 PM
PDO quote method gives invalid result with single quotes inside string ・ PDO_INFORMIX ・ #81053
 
@LeviMorrison how did have get it wrong?
 
It seems the one person who uses Informix is having a bad day...
 
PHP:

$bar = bar(?);
return foo() |> baz(?, $bar);

Hack:

return foo() |> baz($$, bar<>);
 
"wrong" here doesn't mean "OMG never use this feature!" rather it's handicapped itself pointlessly. Here's why: what do you do more often, pass the same parameter to another call twice, or use partial closures outside of piping contexts?
The latter, by far. I wouldn't be surprised if it was something like 300:1 or more... yet they wrote syntax for the former.
 
return foo() |> baz(?, bar(?)); would work fine in PHP, as planned. bar(?) would evaluate first and return a new closure object, which would then be bound to a param for baz() to produce another closure, and the return value of foo() is passed into that closure.
 
2:46 PM
the example above doesn't pass any parameter twice, those are two different things that in PHP would use the same syntax, that only brings confusion
 
@JoeWatkins Much appreciated. So if I'm understanding you, the receiving side must also have some way of handling named arguments? I was reading through zend_vm_execute and couldn't immediately find anything in the RECV_ opcodes related to reallocating them.
 
no it's the send side, grok zend_handle_named_arg
 
now we are in another problem, while this takes 1 branch in hack, in PHP it would need 2:

return foo() |> bar(baz($$)); vs return foo() |> baz(?) |> bar(?);
 
That's a good thing. Getting rid of foo(bar(baz($x)) is the entire point.
@JoeWatkins I'm trying to negotiate to an implement-able middle ground here. :-) Would this work?

1) Zero or more [?|value], which either copies the param def from the underlying function or binds the value to it, in positional order.
2) Zero or more named arguments with values, that binds the value to that argument. Same semantics as named arguments elsewhere.
3) Zero or one ..., which copies "any other parameters not already accounted for".

That gracefully falls back to foo(3, 4, ?, 6), and to foo(...), or to foo(3, 4, ?, ...). And therefore covers the 98% use cases.
 
@JoeWatkins Yep that's what I originally found to make me curious, and it got me wondering why if the func has to be known to handle the argument names, why the types (and defaults) aren't done at the same time, if it's just a relic from pre-named or what-not.
 
2:51 PM
> 2) Zero or more named arguments with values, that binds the value to that argument. Same semantics as named arguments elsewhere.
I dunno if I'm not using the right words or something, so I'll try again ... the distinction between a placeholder and an argument doesn't matter, semantically people expect either to mean "accept this parameter by name in this position", which requires the ability to re-order if you don't place the restriction that call sites must use args by name if application sites use named args ... you either have to be able to re-order, or force the programmer to maintain order ...
 
not really, no. we would be making things complicated for the sake of making them more complicated.
 
@SaifEddinGmati And here's where it differs from Hack. Hack pipe's RHS is an expression. Which no other language with pipes does. What I am proposing, the RHS is a callable, which is consistent with every other pipe-using language I know of.
 
@SaifEddinGmati To be clear, that Hack expression the same as saying bar(baz(foo())), right?
 
@MarkR I'm not sure about the cause/effect relationship here, but part of the problem is overloads. PHP doesn't have an actual overload mechanism (different routines chosen at call time for the same name) so anything that presents itself as an "overload" (e.g. the two forms of strtr) can only be implemented by checking the types in the callee - it has logic, it's not declarative
 
@JoeWatkins I think a code example would be more apt, so having function foo($a, $b), you do not agree with making foo(b: ?, a: ?) equivalent to fn($b, $a) => foo(b: $b, a: $a), right?
 
2:55 PM
you mean the reverse of b: $b, a: $a
 
@LeviMorrison so is the PHP one, yes, it's just a small example of what could be a big pipe operation with 2 small branches, in hack you could merge these two, in PHP you can't.
 
@JoeWatkins hm?
 
@JoeWatkins I... am confused. $has = in_array(?, $values, strict: true); // You're saying that's hard?
 
oh sorry, yeah
 
cmb
@Crell you want (foo ∘ bar ∘ baz)($x) :)
 
2:56 PM
@cmb What ICU version does windows use? (And where I find out which versions are used in general?)
 
@cmb And a way to deal with foo, bar, and baz being multi-argument, but you fill in some of them in advance. :-)
 
cmb
we're always using staging, so IC 68.1/.2
 
I agree that's what people want, I don't agree we need to support named arguments at all for the core feature to be useful ...
 
cmb
ICU 69.1 gave an awful lot of failing tests (maybe I just had a bad build)
 
2:58 PM
@cmb Thanks
 
@JoeWatkins yes, it's not needed for basic usefulness and could be added at a later point in time. But I think it should be added at some point.
As in: there is no non-technical reason to not have it, I think.
 
@JoeWatkins If it's the choice between having no named arguments at all and having nothing, I'll take no named arguments at all. No question. I'm just not clear on why named arguments (with no placeholder support) complicates it so much, since their order naturally doesn't matter.
 
when I look at the complexity that basic application has over just a pure implementation of (...), that looks like a big win ... when I look at the additional complexity that supporting named parameters brings both in terms of the implementation but also for the language, it doesn't look like a win anymore, I wouldn't want to read code that uses this feature in the way it is designed, and I have to read code ...
 
What code are you afraid of reading? Because the $has example above looks self-explanatory and pretty sweet to me, so I'm not visualizing the negative examples you are, apparently.
 
@Crell well it does, the moment you combine it with the most popular interpretation of ?, which is 1:1 ...
 
3:03 PM
Levi and Trowski convinced me that ? had to be 1:1, not multiple, which makes me sad but I accept that the world is not fair.
Context: If we can as the RFC authors agree on a reduced scope, I fully expect it will be on me to explain in the RFC and on the list why named args are just too hard. :-) That means I need to be able to grok why they're just too hard so I can explain it to people who haven't been discussing it daily for the past week.
 
cmb
@Crell I understand what you want; I'm not sure whether I like your proposal; would need more time to evaluate, but E_TIMEOUTED :)
 
@DaveRandom IDK what that is
 
I'm asking for a concrete example of where named args in partials becomes overly complex and establishes an upper bound for us, since you clearly have an idea of some and I'm not getting it.
 
why don't I want to read code that contains magical function declarations that don't contain visual types, where the order of arguments bares no sensible resemblance to the declaration site ? I mean, are you looking forward to that ?
 
Pretty sure I said this before, but I'm totally for a proposal that doesn't support named params at all on a partial call. I don't think they're really necessary initially, if at all.
 
3:09 PM
@JoeWatkins I think the point of pfa is not reorder and use below, but reorder and pass forward to a function which expects that given fixed order
 
I agreed with Joe that using a partial to effectively redeclare a function is not what it was meant for.
@bwoebi That might be over-reaching, then use a short closure where you can declare types and defaults.
 
Right. If you want to do complicated shit, that's what fn() is for.
@JoeWatkins Named arguments already allow out-of-order usage. That's kinda their thing. You are... partially callling, the underlying function.
 
@Gordon broken
that's all you need to know :-P
 
I'm just not wrapping my head around why named args makes it so much harder to read; and if I'm going to fend off people asking that question so they don't bug you, I'm need to be able to wrap my head around it. :-)
 
@Crell you see named parameters at a call site and it doesn't matter they are out of order, you can still look at the declaration ...
if we implement named parameters as proposed, you see what looks like a positional parameter at a call site, where do you look now ?
 
3:19 PM
(phone call, one sec)
 
@cmb I was wondering if two test failures on FreeBSD were due to ICU 69.1, but after doing a local build with that version, doesn't seem to be. I'm not seeing any test failures (though there is one build warning)
 
cmb
then I likely had a bad ICU build; will retry ASAP
 
Before I send an email to internals about the is_literal RFC, can someone sanity check this example script. I'm wondering if it would help explain it, where I think it covers everything for SQL, notes that it's for more than SQL, and how it can be used without breaking everything.
 
3:36 PM
Side note: The US banking system is the most incompetent bunch of 19th century morons that the world has ever seen.
 
No they're not, they're filthy rich and enormously successful, they just don't want you to have have any money ;)
 
@JoeWatkins @Crell What do you think of this proposal? No named params, clear intention with extra params, ? is one-to-one.
 
@Crell (hold my beer, have you seen the UK banking system?)
 
@Crell What's your specific gripe today?
 
@CraigFrancis You can actually send money to companies in Europe with less than 4 trips to 2 different banks, right?
Wire transfers, mixed domestic and international. One bank doesn't do it, one only does it in person, one bank gives me inconsistent information about what information I need, and one claims to support it but doesn't actually, at least not with my new employer.

Mattresses stuffed with dollar bills would be more useful than these jokers.
 
3:39 PM
@Crell Erm, not quite... did have to do the identity thing for an international payment, and my closest branch couldn't do it (after failing the online banking thing)... so 2 banks, 1 long trip.
 
Unfortunately that level of incompetence is not limited to banking, lol
 
@Trowski f(?, z: 1); // Error I'm curious why this would be an error.
 
@MarkR Avoiding named params altogether on partial calls.
 
@JoeWatkins ... So, if I'm understanding you, you're not concerned about $has = is_array(?, $arr, strict: true); You're concerned about the call to $has(? strict: true);, because it's no longer obvious where to go to see what "strict" means. Is that what you're saying?
 
cmb
@Sara is it? :)
 
3:42 PM
@LeviMorrison Sorry Levi, I was a bit abrupt on Sunday, the WHERE IN case comes up quite often and it does work with is_literal(), simply because you can concatenate multiple literals and still be seen as a literal.
 
@CraigFrancis Does this work? stackoverflow.com/a/23641033/538216
That's my highest-rep answer on SO btw.
 
It would need a tweak, to do it via a concat (I just changed my main project over from that, was perfectly fine).
 
IMO, if that doesn't work it's not robust enough yet.
 
@Crell I'm talking about call sites, which tend to be far away from declaration sites in real world code ... at a call site, named parameters are out of order, but they have a name, so you can just look at the declaration directly ... if we implement the full scope of support for named parameters (which seems to be the only thing that will please enough people for it to pass), you're going to have what looks like positional parameters at call sites which are actually named ...
 
@JoeWatkins I don't think reordering is required to pass, so long as you can't use named params with placeholders.
 
3:48 PM
@LeviMorrison Actually, i've just tested it... and it does kinda work... you just have to change join() to literal_implode().
 
@JoeWatkins This would be alleviated to a degree if callables signature type-checks were an option, I think.
 
It was the misleading that was most objectionable, not that it necessarily needed to be supported.
 
@CraigFrancis It should not need to change at all. It needs to understand concatenation of literals in the engine as well as userland. It can't just be userland.
 
But if we do that I'd get a load of internals people voting it down because it affects too many things.
 
@JoeWatkins And at the same time, if type-checks on callable signatures were a thing, then this PFA feature is actually quite valuable as well, because it's tedious to write all those types in the closure just to satisfy the type checker.
 
3:50 PM
@Trowski I don't even need them for placeholders.
 
Do you agree, or are there cases you can think of where the call site is far from the definition site but doesn't pass through a callable check?
 
@JoeWatkins Please, I'm begging you, code sample. We're very clearly talking past each other, because I do not know what you're talking about. "Positional parameters that are really named" - What? I don't know what that means.
 
@Crell Did you mean bound args?
 
I don't think we're using the same words for things. Code samples, people. Code samples!!!!
 
I'm unsure what is not clear, you declare a function, you reorder it's parameters, you call it later without names for those parameters, the order of parameters no longer makes sense at the call site, they look like positional parameters but are not ...
 
3:56 PM
"you reorder its parameters" -NO! I am completely OK with telling people who want argument reordering to go use fn().
Make foo(bar: ?) a fatal error.
 
@JoeWatkins They are positional to the closure. Just go look up the position of the placeholder. If you want to complain about such things you need to go one layer deeper, where you take partials of partials where there is re-ordering in each, or something.
 
@LeviMorrison At the moment, with Joe's and Dan's implementation, literal_implode(',', array_fill(0, count($ids), '?')) works... anyway, if I put forward the RFC, would you vote for it on the basis that join(), and presumably implode(), also pass though the literal flag? (which I think others would vote down for performance concerns).
 
reordering, and any sensible level of support for named parameters cannot be separated from each other ... if we support named parameters only and the most popular interpretation of ? which is 1:1, no named placeholders, then ?, nameOfFirstArgument: arg is an inexplicable error because "it doesn't matter what ordre you send named parameters" ...
 
$f = foo(b: ?, a: ?);
$f(1, 2); // look them up by positions of `?`
 
abs on string fatal error ・ *Math Functions ・ #81054
 
3:58 PM
@LeviMorrison there is no real world code that will look like that
 
@JoeWatkins So that's an error. Problem solved. You already can't use a named argument that is also used positionally, and can't use a named argument that would have been between two positional arguments.
 
@JoeWatkins Perhaps, but it will likely go through a callable parameter check. Add callable signature verification and your complain goes away, yes?
 
in_array(?, $arr, needle: ?) // E_YOURE_STUPID
 
yeah, but that's a solution that doesn't exist
 
@JoeWatkins But it should. We added plenty of features that "should" require generics but we didn't block them until we got generics.
 
4:01 PM
in_array(4, $arr, needle: 4) is already an error. I don't see why it wouldn't be with partials.
 
(oh, and thanks @LeviMorrison for your implode example on SO, I had already up voted it, so I assume that's where I originally got your implode idea from, as I finished my move away from escaping values).
 
@CraigFrancis And any other internal functions which obviously do concatenation. I haven't done an audit.
str_repeat, for example.
 
@LeviMorrison but that's never going to get the votes, it will be seen as too much of a performance hit (no matter what the actual numbers are).
 
@CraigFrancis Why? I don't understand.
 
@LeviMorrison because every time you have to check A and B are literals, it will slow down the script execution... any slow down seems to be an issue (remembering that most RFC's fail, and I've got to get 2/3 of the vote).
*sorry, seems to be an issue people care about
others will just say it's not necessary, why do that.
may be it could be accepted for 8.2, when we get feedback from those using it?
 
4:07 PM
With str_repeat you don't have to check on every internal concat. You see if the original is a literal, and if it is, then the result is a literal. With join, it's going to be more expensive. But still, if you want this feature to work, it needs to work with obvious string concatenation functions.
 
as in, get the current implementation in for 8.1, than look at implode, join, str_repeat, etc later?
 
I don't understand why these functions have performance issues that regular string concatenation in userland doesn't?
 
@CraigFrancis I would vote no if it did not work with join, str_repeat, etc.
 
I'm not familiar with internals, and I'm really not experienced with C (Joe will attest to that), but my understanding is that the more checks/modifications are happening, the more of an impact it's seen to have.
 
Yes, but why is the overhead of userland string concatenation okay but not the overhead of doing it internally? Until I have a reason, I will also vote no if it doesn't work with str_repeat and join/implode.
 
4:11 PM
ok, so is my next task to go though all of the php functions, and see what else needs to preserve the flag?
 
Is userland overhead optimized away with opcode specialization or something?
 
@CraigFrancis you're talking to two other internals guys ... you see ow much performance is on their mind, like I tried to say a bunch of times, it's more important to be complete than go fast ...
 
ok, sorry, I was going on comments from Dan, who seemed to view it differently.
I'm assuming not explode/substr type functions... I assume they won't need a change.
 
cmb
@GabrielCaruso, hmm, it seems that @Sara may not be able to roll 8.0.7RC1? Could you step in, if that is indeed the case? :)
 
I started a review, they're mostly trivial changes ... but they're not changes anyone will accept if you go at it with your performance hammer, if you write a script and show that it's possible to get some level of slow down that would be a problem in the real world, even though the code isn't real world, people tend not to be able to separate them, they see "poor performance", and they'll (quite logically) decide it performs poorly ...
 
4:15 PM
and not nl2br(), that might be risky from a HTML context point of view.
 
you need to forget about performance, and design the thing that makes most sense, like which functions need to be modified for completeness, which might be done at a later date ... but don't open up the future scope too wide ... focus on the future scope of this feature ...
 
perf wise, I think your implementation is fine, but I've had a few people who seemed to really focus on it, saying it will never happen, etc.
(oh, and I think, that's also backed up by Máté's tests, which should hopefully provide some confirmation that perf isn't an issue).
 
you know where I am if you want me to do anything, but choose a path ... I'd have thought it would have been acceptable to have consistent vm/compiler support, with maybe one or two specialised functions, and have the future scope be modifying parts of standard library ... but these guys are saying they wouldn't vote for it without that support initially, and I'm sympathetic to that ...
(for the same reason I want the vm/compiler to have consistent support) ...
 
@Crell UK Govt: Hold my beer
 
@JoeWatkins Does that ameliorate your concerns at all? The case you're describing as problematic... is already problematic with named arguments today, which is why it's already disallowed. Keep disallowing it.
 
4:26 PM
@JoeWatkins I'm sympathetic to that too, I would like those functions to support it as well, it just feels like I've had at least two strong warnings telling me not to go down that route, so I've spent a lot of time trying to find ways to avoid touching those functions (and those work arounds do work, it is possible to code with it, but they might require a couple of tweaks).
oh, and to justify your argument further implode(['a']) does work, it's just when a second value is included that the modification happens.
 
For str_repeat specifically the overhead and complexity is going to be trivial, isn't it?
 
I would have thought so
but I can't write C :-P
 
@CraigFrancis Link to the implementation?
 
github.com/craigfrancis/php-src/tree/is_literal-with-functions ... Joe really had the main version, but this one includes the literal_implode() and literal_concat() functions from Dan (where I think I've managed to merge the two, but who knows).
So I've got... implode/join(), str_repeat(), str_pad() to change... array_pad() & array_fill() already works... and I don't think we should do anything in reverse, like explode() or substr(), because this is going to be used for security reasons... and I don't think we should consider anything like nl2br(), which might cause other issues (i.e. not knowing the HTML context).
 
4:52 PM
Just for my own sanity, who would vote for is_literal(), with these modifications... as in, are these the last sticking points for you, or are there other concerns I need to address?
 
I am still undecided, personally. Which string functions are or are not modified to be "literal safe" is of minor importance to my vote.
 
ok, that's fair... can I ask what are issues with it? yesterday you mentioned the value in it, which to me is about trying to address the main security issue on the OWAP Top 10.
 
01:00 - 17:0017:00 - 00:00

« first day (3868 days earlier)      last day (1087 days later) »