« first day (3861 days earlier)      last day (1078 days later) » 

5:00 PM
@JoeWatkins So the root problem right now is that AbstractFunctionReflection does too much, and some of it should get moved down to ClosureReflection. Could that be done, or would it break 50 other things?
 
it can be done, I don't know if it's a good idea to actually do it, especially as part of this change ...
 
I'm not 100% sure on the exact reasoning it applies only to properties, but zend compile singles out callable for compile time rejection.
 
I believe reflection needs to be reworked, but it looks like a 9 thing at this point ...
that's the root problem when it comes to reflection, the root problem when it comes to runtime is that we've forced this strange inheritance ...
 
@FlávioHeleno nice! I just left a comment, otherwise lgtm
 
and the reasons for doing it make no sense to me today, so we're clear ...
 
5:02 PM
@MarkR There was some wonkiness with differentiating $foo->bar() when bar was a callable type vs a method. I forget the details, but Nikita felt it was best to punt on it when property types were added.
 
I thought that's why we had to do ($this->foo)(...)
 
maybe in 9 callable is promoted to a (slightly magic, or maybe not) interface
 
Help me understand why there is a problem with Closure. A partial is a class with an __invoke magic method. Why is there any sort of problem with interactions with callables and closures which doesn't already exist?
 
Delete string and array callables, problem solved \o/
 
5:04 PM
@cmb I think the large comments have been removed from all these gd_{imagetype}.c files
 
Closures have extra functionality, rebinding scope and objects, partials don't have or need that
a class with an __invoke is a callable, not a closure, and we're declaring it to be a closure
 
@JoeWatkins Why declare it to be a Closure?
 
I was forced, for reasons of forward compatiblity with callable types (don't understand that reasoning really), and for introspection reasons (which aren't strong, that mess is not our doing), and so Partial can pass Closure type hints (but it should be passing callable type hints) ...
 
I don't honestly think it needs to pass Closure type hints. The forward compatibility with callable types I do care about, although I'm not sure if @Danack is going to be able to get to it this cycle. :-(
 
5:08 PM
What is this "forward compatibility with callable types" stuff?
 
Sounds like there's need for a new superclass interface that just defines the invokable element (if callable is a no-go due to aforementioned issues)
 
@MarkR How is this different from callable?
 
it's as compatible as closure is without needing to be a closure, I'm saying ... if we can make a closure compatible with a callable type hint, we can do the same for partials ...
 
@LeviMorrison Callable has restrictions on where it can be used e.g. 3v4l.org/LQ9ZW
 
Yes, of course. I don't understand why this concerns partials at all?
 
5:10 PM
Invokable
 
We're talking about passing type checks are we not? So where the type can be used seems of relevance.
 
I think we're not all talking about the same thing, is the problem.
 
Partials will pass any callable type check, wherever that is permitted. If you need a closure specifically, Closure::fromCallable($partial) will work, yes?
 
I don't think adding more hierarchy is necessarily the answer to anything ...
 
Based on what Joe was saying, my impression was that they shouldn't pass the check
 
5:12 PM
> Closure::fromCallable($partial) will work, yes?
no
 
@JoeWatkins That's a problem, unless Closure::fromCallable() also doesn't work for arbitrary objects with __invoke?
 
It currently returns the Partial as-is rather than wrapping it in Closure{}
 
Closures have the wrong invocation mechanism, you get the wrong trampoline ...
(you can't enter what it would return)
 
Does Closure::fromCallable($objWithInvokeMagicMethod) work or not? Why would a Partial need to be different?
 
yeah it works
let me read/think a minute
ok here's what we do, we drop Partial extends Closure, we make Partial final, we change Closure::fromCallable to handle the special type of callable that is Partial
 
5:20 PM
@MarkR The Typed property RFC says callables aren't supported due to context dependency, but the same logic applies to return types, so I'm not sure why the inconsistency.
 
that's where we've (I've) gone wrong, we shouldn't extend Closure at all, we should just handle the new type of callable in the places where it needs handling ...
 
@JoeWatkins Totally agree with this.
 
including possible future places currently not in existence ...
 
So Partial becomes its own thing, which means Closure::fromCallable() won't blindly pass it through thinking it's a no-op, and will wrap it the same way it wraps everything else? Does that mean ReflectionPartial goes away, or is that still there but the Closure::fromCallable() technique makes it less needed?
 
ReflectionPartial is kept, Closure::fromCallable will return instanceof Closure, with an appropriate trampoline to get us into Partial::__invoke at call time ...
 
5:24 PM
@JoeWatkins Why doesn't it work out-of-the-box? Why is it different from regular $objWithInvoke stuffs?
 
Cool. I'll update the RFC accordingly. And add a section on the Partial class, the justification for which is "so that it doesn't have all the extra flotsam that closures have". Plan?
 
@Crell Ping me with the draft before sending anything to the list, please!
 
@cmb exactly
 
@LeviMorrison Of the email or RFC updates?
 
@Crell The updated RFC is what I was referring to.
I'd like to review it before we tell the list we've changed anything.
 
5:27 PM
Ah, I was writing a response to Alex now to say we're going to change things. :-)
 
cmb
@BenMorss these doc blocks have been added to external libgd a few years ago; they can be added to bundled libgd
 
Tangential to this conversation, does it make sense to allow callable on typed properties, especially considering this behavior: 3v4l.org/li79g
 
@LeviMorrison the calling magic for Partial and Closure are distinct, there's no reason to think it would work out of the box ...
 
I'd love callables on properties, but I trust Nikita when he says it's too hard/confusing. :-) Also, partials will allow for the private there to escape, as a partial. (It works today if you return a short lambda that calls the private method.)
 
@JoeWatkins Doesn't Partial have __invoke()?
 
5:31 PM
yes
 
Then why doesn't it Just Work?
 
because Partial is not a Closure :D
 
@Crell Yes, but then the property has to be a Partial, so you have to know that's what you're getting.
 
Can you explain the technical things a bit more? Surely you can do $partial->__invoke() and it works, right? Why isn't that enough for Closure::fromCallable($partial)?
 
you're creating a Closure, with calling magic for a Closure ... __invoke is not a thing that makes a Closure, __invoke is a thing that makes a callable ...
 
5:32 PM
I'm curious what the challenges are to a property being callable vs. a return type.
 
@cmb thanks! I'll leave mine in, then.
 
@Trowski Whether it is callable changes with scope, I believe. Since closure has bound a scope, that's why closure works and callable doesn't.
 
> Surely you can do $partial->__invoke()
 
I may be mis-remembering or under-representing the issue, though.
 
5:34 PM
@cmb that makes more sense than what I'd thought - which is that people had removed existing comments
 
If Parial::__invoke exists, Closure::fromCallable() should require no modification.
 
@JoeWatkins But it exists, yes? If it exists but can't be called that's a problem.
 
@LeviMorrison Fine, but then why is callable allowed as a return type?
 
no, it doesn't exist
 
Oh. You said it did or maybe I misunderstood in the chat cross-fire.
 
5:35 PM
it has an __invoke, so does Closure, but you don't see them in Reflection
ah
don't do anything to anything
 
/me stops editing the RFC.
 
@cmb one more question: can I ignore /ext/fileinfo/tests/magic? Looks like it contains info for the UNIX file command, but I'm not sure why it's in this repo...
@cmb that is, I'd need to request that the maintainers of file and magic add info here for AVIF
 
@JoeWatkins I don't understand. Is there a handler for __invoke or something you are using instead? How does it simultaneously exist and not exist?
 
5:50 PM
\o
 
@Crell very unlikely. Not only am I struggling to get anything done (like help @IluTov with the type alias rfc, which would be a precursor), I think there's also stuff that would be more important for me to work on. Namely better comms tools for open source projects, as internals is obviously a shitshow and is now actively hindering people being productive.
 
Here bc JS room is so dead I cant even find it
Is there something like CSS !important for JS?
Plz dont laugh
I have a line that is straight up being passed up
 
... what are you trying to do?
 
It does the lines b4 and after but not...
 
@Stuart This is a PHP channel, mostly developing of PHP itself. It's not an appropriate place to ask JS questions. There are many other venues that are better.
 
5:55 PM
fileUploadForm.style.minHeight = '27.5em';
Plz spare me @Crell
 
@MarkR Make a text based communication platform that is open, but resistant to disruption. How hard could it be?
 
and the hippie pic above is?
 
Thank you @Danack
 
@Stuart You have been given moderation feedback. You are apparently choosing to ignore that feedback. Ignoring moderation feedback is a good way of getting kicked from the room.
 
@Danack Sad panda.
(Though I'm not convinced it's really a prerequisite.)
 
5:58 PM
Also, although you obviously have passion for your project, you should probably think about hiring a designer, who understands how to make frontend stuff look good. Not saying that will actually make your product be sucessful, just saying that I think it probably won't succeed without that.
@Crell makes it easier at least. gets the conversations about how to alias types out the way.
 
I'd say they're complementary but independent. Either could happen first.
 
On the topic of jobs, I have an opening coming up if anyone of prerequisite skills is interested in working on e-learning and live streaming :-)
 
Regarding comms platform, an example of one thing that this room lacks is a clear way of indicating to someone "this is feedback from a room owner. Ignoring the advice is risky". As at least 50% of the time that moderation feedback is given, the person chooses to pick a fight.
 
A "put on moderate hat" button? :-)
 
something....oh which reminds me.
yesterday, by Joe Watkins
well that's just wrong, I don't want this crap to keep jumping to the top of my screen several times an hour while I'm awake ... it's a waste of my time and effort even though I'm not reading it or participating, it's still going on right in my face ...
 
6:04 PM
IRC had a fix for this. It was the "@" character.
Simple, subtle, VISCIOUS
 
@JoeWatkins hypthetically, what text would you like to have on the button that you click to indicate that "although something is not totally against the rules, the people who are taking part in the conversation should go have that conversation somewhere else"?
 
Don't need a button. Just a countdown.
10... 9... 8... DON'T MAKE ME GET TO ONE!... 7...
 
meh.
 
((Joking about that mood when a parent counts to ten))
 
krakjoe@Fiji:/opt/src/php-src$ sapi/cli/php --rc Partial
Class [ <internal:Core> final class Partial ] {

  - Constants [0] {
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [1] {
    Method [ <internal:Core, ctor> private method __construct ] {

      - Parameters [0] {
      }
    }
  }
}

krakjoe@Fiji:/opt/src/php-src$ cat partial.php
<?php
function test($a, $b) {
    var_dump($a, $b);
}

$partial = test(?, 2);

$partial->__invoke(1);
@Crell @LeviMorrison yes ?
 
6:07 PM
@JoeWatkins I think, but why doesn't reflection show __invoke?
 
magic, doesn't for Closure either
it's not really there ... don't worry about it ...
 
"magic" as in because it's a magic method or even more elaborate magic?
 
@Sara good times.. <3
 
Can you throw in var_dump(new ReflectionFunction($closure)) at the end, for good measure?
 
Why can't __invoke exist? If it did and worked, wouldn't that make everything else in the callable and closure ecosystem Just Work?
 
6:09 PM
Or something like that to see what it does with ReflectionFunction.
 
object(ReflectionFunction)#3 (1) {
  ["name"]=>
  string(8) "__invoke"
}
 
@Sara The other side of the same problem is that most current platforms make moderation be a confrontational thing....actually, here have some words that I wrote: github.com/AlwaysSeptember/Overview
they might make some sort of sense.
 
Bueno. That simplifies things greatly.
@LeviMorrison @JoeWatkins wiki.php.net/rfc/partial_function_application - RFC updated here. Please review. (I added the Partial class section, and modified the Reflection section. No other changes.)
 
ok I'll push branch, can you add tests that were mentioned in nikitas initial review, and anything to cover ... just more tests ...
okay pushed ...
 
I think I already added tests for what Nikita had mentioned, didn't I?
 
6:18 PM
@Danack not words you should say in polite company
 
@JoeWatkins What did you change?
 
added magic for __invoke, so that you can execute it now, and fixed zend_create_closure_from_callable to use the correct trampoline ...
diff HEAD~1 :)
@Crell no, he reviewed a few hours ago and I don't see commits after
 
Oh, on the PR?
 
yeah
 
I'm still confused. There is a ZEND_METHOD(Partial, __invoke) in there. Why isn't it seen and available?
 
6:23 PM
@CharlesSprayberry I'd like github.com/amphp/injector/blob/… to automatically modify TypeRules and make TypeRules immutable. Should Provider simply have getTypes()?
 
I'll have a look and see.
 
Does is_callable($partial) return true now?
 
Yes. Just tested it.
And $ref = new ReflectionFunction(Closure::fromCallable($p)); now works, too. Woohoo!
Is the updated RFC text acceptable to mention?
@JoeWatkins github.com/php/php-src/pull/6898#pullrequestreview-641905753 - You've updated the Stub now as well, I presume?
 
IMHO you've greatly reduced the value of this feature
 
Porquoi?
 
6:35 PM
The primary value of partials is not in partial application, but in the basic $foo->bar(?) first-class syntax for acquiring callables. These need to have Closure type to be useful with existing type declarations
At the very least you need to introduce a common super-type for Partial and Closure
 
Isn't that callable? (It's not actually a super type, but it covers what you actually care about.)
$foo->bar(?) still works, and it's still callable.
 
callable is callable-at-point, which is not a useful type, and for that reason discouraged, and not supported in key places, like property types
Closure is the (de facto) type of unconditional callability
 
@NikiC Yet for some reason is supported in return types: 3v4l.org/li79g
 
@NikiC Objects with __invoke are fine, right? This is "faking" it as far as I understand. I don't understand yet why it's not just doing it that way, especially as there is a Partial__invoke method in the PR.
 
@LeviMorrison You can't type against "an object with __invoke"
 
6:39 PM
@NikiC It's a callable, yes?
I know you can't use that everywhere, liked typed properties, I get it. But you can Closure::fromCallable($partial) it.
 
@LeviMorrison That's horrible
 
Right now, callable is the closest we have to "you can put () after it and it does something on a stack frame."
 
a common super type seems the cleanest thing to do to me
 
@NikiC But it's a reality that exists today.
 
I would have thought the point of partial application is getting that Closure::fromCallable() with first class syntax
 
6:41 PM
A parent Invokable that includes callable, Partial, and Closure would be fine by me, but I'm not entirely sure what it buys us over just callable.
 
If I need to write Closure::fromCallable($foo->bar(?)) I can just as well stick with the Closure::fromCallable([$foo, 'bar']) I'm using now
 
@NikiC The point of it is to make referencing a callable with some of its args included easier. Where "some" could be 0.
 
@Trowski callable is slightly less broken for return types in that it does not completely break the type system -- it just provides a much weaker guarantee than people might think
 
As far as I'm concerned, you just said we should just as well stick with [$foo, 'bar'] for all cases. Why is the arg to Closure::fromCallable treated differently from any other callable instance in your mind? A callable is a callable is a callable. If you need a Closure specifically, then make one.
 
From a user POV, the closer equivalent is fn($x) => some_func($x, 5);
 
6:43 PM
@LeviMorrison Because Closure::fromCallable([$foo, 'bar']) will be callable even if $foo->bar() is a private method that is not accessible in the scope you pass it.
It might not even resolve to the same method! You can pass ['self', 'foo'] as a callable, and that will just call something completely random
 
You can already return $foo->somePrivate(?); from a method now and it works. We have a test for that.
 
So an Invokable interface attached to closures, partials and anything with an __invoke method?
 
@Crell I'm talking about the callable type
As I said before, callable only guarantees callable-at-point, not callable
 
@NikiC That's a feature that is debatably a bug.
 
@LeviMorrison No, that's very much not a bug
 
6:46 PM
I've been bitten more by passing a private method as a callable to some other thing, and it ends up having a privacy violation. It was valid at the point I "created" it.
That's what I mean.
Binding its scope at call time vs creation time.
 
oh yes
 
It's just different behavior.
 
An Invokable interface that's similar to Stringable would get no objection from me, but it would then exclude a string that is a function name, for instance. So it's strictly narrower than callable.
 
Yes. Different broken behavior ;)
 
@kelunik If I understand you correctly, you're suggesting that we iterate over $provider->getTypes() and add them to TypeRules?
 
6:47 PM
But it stems from when the scope binding happens. I propose that it should be bound at partial creation time, not the scope at which it is called.
 
@Crell That's fine, because you're not supposed to pass 'strlen' to it, you're supposed to pass strlen(?)
@LeviMorrison Yes, of course
 
OK, so you're thinking ahead to when when basically no one ever uses any callable syntax other than partials, ever.
 
Adding invokable opens up the opportunity to eventually phase out callable, I'd think? With string and array types eventually being removed in favour of a helper method on something or another to create them from those mechanisms
 
@NikiC Okay, two yes's in a row is good, but that confuses me because now I don't understand your response to this.
 
@MarkR Just about sent this message myself. I like this idea I think.
 
6:49 PM
Which is not a bad future to live in, but I'm not sure we're going to get there soon. :-) In part because you cannot use that for static generation of a compiled container or similar.

... can you?
 
I like the idea of string and array callables going away.
 
I'm fine with an Invokable interface but IMO it should have __invoke on it, and Closure and Partial should have __invoke. To change my mind on this I need some explanation of the magic of why __invoke exists but also doesn't exist on these types.
 
For one thing, I just remembered, __invoke() has no enforced signature. A given interface can declare __invoke with a signature of its own however it wants, but there's no signature enforcement from the engine.
 
Well eventually function signatures will likely want to be mangled somehow into their own interface with a given __invoke args I'd imagine?
 
6:56 PM
@Crell Ah, right.
 
function foo(int $a, int $b): C { } would as a partial automagically get a InvokableIntIntReturnC interface (just an example) and:

function dosomething((int, int): C $callback) would automagically convert to requiring a InvokableIntIntReturnC parameter? or is that not the way it would go
 
When an interface is involved the __invoke signature has to match.
 
@MarkR That makes me cringe, honestly.
 
Invoke interface that can only be implemented by Closure and Partial? I really didn't like this sort of thing about Traversable...
 
And auto attached to classes with __invoke?
 
7:00 PM
It could only be a marker interface.
 
Yeah, it doesn't need to actually have the __invoke method signature as part of its interface, only check that it has an invoke or invoke like mechanism is present
 
Would have to think about that one, but maybe.
 
Traversable = can use with foreach/yield from. Invokable = can use with ()
I don't hate that (don't love it either)
 
@NikiC Your comment on the PR: "I'm missing a test for __call/__callStatic trampolines." - What do you mean? What sort of test are you looking for there?
@Trowski PHP, mutating into an all-object language in the slowest and sloppiest way possible. :-)
 
@Crell Just something that uses a partial on a method that resolves to __call
There is Magic involved there that is easily broken
 
7:02 PM
Ah, OK. I... have no idea what that would do right now. I guess let's find out. :-)
 
Invoke as a special interface that means __invoke is present but doesn't do any additional enforcement of its signature is better -- could be implemented by any type this way. Whether automatically opting it into the scheme if it has __invoke... I guess?
That not all callables are Invokable is weird by nomenclature. In C++ they call these function objects or sometimes functors.
 
/me hisses.
 
Functor is not as nice of a name, but I'd like something that better communicates that these are objects, not array or string things that are (currently) callable. It is at least a name used in the wider literature...
 
Functor in C++ does not mean functor in category theory. It took me weeks to realize that the two separate meanings coexisted, and I have been furious at the C++ authors ever since.
Do not bring that shit to PHP.
 
FunctionObject then?
 
7:08 PM
At least it's descriptive.
CallableObject, since we already have callable?
Though at this point I'm not clear what problem we're solving, honestly.
 
A single type that can represent all invokable / callable types regardless of access :-)
 
If we name the interface Invokable I think it's a bit weird that callable isn't "invokable". I'd like the interface name to communicate the object-ness a bit so that this doesn't happen.
 
Well we could get rid of callable, then that problem is solved.
 
We can't until all of its use cases have been consumed by other things, and then wait until the next major PHP version.
 
Partials + Closures would meet all requirements right?
 
7:14 PM
We also need to allow for static generation. Containers, event dispatchers, and the like often take in function or class names as strings now so that they can generate optimized code. But you can't do that with a closure, and I presume not with partials.
 
Which is where we would need the helper methods on Closure::
 
Unless there's a clean way to decompose a partial back to its original function and arguments.
Which would only sometimes work anyway.
 
So pass around arrays and strings all you want, but if you want them to be invoked from the engine, you have to create an invokable from them.
 
@NikiC @JoeWatkins Ha! Good call on testing that. __call() currently does get called, but core dumps afterward. :-)
Failing test will come in my next push.
 
Introducing Invokable should deprecate callable. Partials can replace any string or array callable, yes?
 
7:19 PM
Maybe.
 
And eliminate non-sense like ['self', 'method'].
 
ha, the common interface can't have the __invoke method
Closures can't declare they implement __invoke
 
Yeah, there was a lot of discussion of that above.
Invokable would probably have to be similar to Traversable.
 
oh sorry, I was doing code, let me read
 
No actual methods, just providing context: Traversable = can use with foreach/yield from. Invokable = can use with ()
 
7:23 PM
Then we bin callable in 2025 or whenever 9.0 comes out?
 
callable is used very widely. Perhaps only issue a deprecation on callable if used with a string or array in 8.1, then make callable an alias of Invokable in 9, and remove in 10.
 
so no methods, and only allowed to be implemented by Closure and Partial, right ?
 
@JoeWatkins and automatically add it to anything with __invoke in
 
@JoeWatkins Why is this?
 
@Trowski Good idea on aliasing to invokable.
 
7:26 PM
@LeviMorrison because of the magic they use at call time that is "easily broken" as nikita put it
really, with the magic, we're all on board with a magic interface ?
 
@JoeWatkins Stringable is similar.
Though that actually has a method definition.
 
Treating it as a tagging interface that can only be created from the engine? I'm fine with this.
 
@JoeWatkins I think it's worth at least looking and the two results and seeing which is better, or if we can improve from both.
If you have the time.
 
@LeviMorrison sorry, what are we talking about now ?
I don't like magic interfaces with ghostly methods
that's too much
 
What's the alternative, a magical type that checks 3 completely unrelated types each time in the type checking function?
 
7:29 PM
@MarkR Internal interfaces have a callback when you implement them so you can add additional restrictions. I'm not sure when exactly it's called so I'm not sure exactly what you can and can't do, but it could possibly enforce that there is an __invoke method present.
So it isn't required that you can't directly implement it; you would just have to have __invoke and it would be fine.
 
stubs were invented 5 minutes ago and now the docs have to deviate from them ? we can't declare the interface has an __invoke method in stubs, or in code ... we can do magic looking to see if there's an __invoke, but this seems really horrible ...
 
@LeviMorrison The engine can also have an exception for Partial and Closure.
They don't need to have an __invoke method.
 
It's looking like there has to be some compromise on "clean" design here. I'm not sure what is or isn't acceptable. But having an interface that userland can't implement seems bad to me. I would rather have a magic "__invoke" check.
 
If the __invoke check is performed when the class is being linked, it can just tag the CE with the Invokable at that time?
 
Honestly... I think it's way premature to be planning to deprecate callable just because we get partials. We have to see if partials really do obviate the need for any other kind of callable, and if there are holes in that, mainly around generated code.
It's possible that in time that may happen, but we shouldn't be banking on that anywhere in the foreseeable future.
 
7:35 PM
@LeviMorrison Well, you could implement it, but only on a class defining __invoke.
 
@JoeWatkins Let me know if you find a design that isn't horrible. Seems like the least horrible design so far.
 
I don't see generated code as an issue, there's no need at all to have strings and arrays as invokable with partials
 
My point is we simply don't know yet if it will go that far. And making plans when we simply don't know yet is unwise.
Especially if it slows down the rest of the RFC functionality for no actual gain. :-)
 
This could go in the future scope of Partials, but this should be separate.
 
You're spending time on it, we're spending time debating it, might as well debate how we can extract the most value from it :-) and getting rid of godawful strings and array callables seems like a valuable prize.
 
7:38 PM
For now Partial should be callable, that's all that's needed. I don't agree with Nikita that it has to be a Closure. I've seen little code requiring a Closure and not a callable.
 
I can't recall the last time I saw anyone type hint Closure. Probably before callable existed.
 
callable existed before Closure.
 
@MarkR The only valuable use-case I am aware of at the moment is this one: delaying visibility checks to the caller, rather than the scope it was "created" in.
 
@Crell I've seen it used on typed-properties, but the class defined the Closure.
 
@LeviMorrison IMO pass it as an array and convert it to a closure before invoking it.
 
7:41 PM
@Trowski Closure was added in 5.3. callable in 5.4.
 
@Crell Really? Huh, ok :)
 
Check the RFC index. :-)
 
@Trowski Based on a quick grep, the ratio of type usage for parameters Closure vs callable is 1:3
 
Wow. Way more usage than I expected. Are you sure that's in actual method declarations?
 
They're not strictly the same though, right? Because closure wouldn't cover __invoke
 
7:45 PM
That is much higher than I expected too.
 
@Crell I'm grepping for 'Closure \$' and 'callable \$'
 
You might be picking up properties then (though probably not a lot)
 
Maybe check just for things on the line with "function" ?
 
Checking Laravel specifically, they use Closure more often than callable
 
@JoeWatkins Does ReflectionPartial have a way to decompose out the original function or method name? It has a getParameters() method, but I'm unclear what else.
 
7:46 PM
My anecdotal experience is every time I've seen Closure as a parameter it was either relying on rebinding, or it was honestly an error and should have been callable.
 
Of course it would be Taylor.
 
@Crell That changes the total count (probably because of multi-line functions), but not the ratio
 
huh. OK then.
 
No, Taylor does it right
I hold that people using callable just don't know what they're doing :)
 
@LeviMorrison Outside of internal methods, I concur.
 
7:47 PM
@NikiC Maybe that's true since Closure::fromCallable, but definitely not before.
 
@LeviMorrison Yes, that's true :)
 
Why force the consumer to call Closure::fromCallable when you could do that yourself if you must have a Closure?
 
This is certainly a modernist view
 
I don't recall Closure::fromCallable() being billed as the great savior of callable consistency. :-) I didn't even realize I could use it to simplify reflection until Nicolas told me.
 
@Trowski Scope has changed :)
 
7:49 PM
@LeviMorrison Ok, that's a good reason.
 
The trouble with typing against Closure is that it's so concrete -- it's biting us now with this partials thing, at least with current implementation.
 
@LeviMorrison Yes, in the sense that Closure::fromCallable() probably shouldn't have reused Closure -- but now that it has, Closure is the de-facto "sane callable" type
 
So maybe then Invokable should be introduced with Partial.
 
Which is unfortunate in terms of naming, but that's how it is
 
Callable::fromCallable() :-)
 
7:53 PM
+Invokable, Closure::fromCallable loses its callable type hint and gets Invokable|string|array, callable gets aliased to Invokable in 9.0 and taken behind the shed in 10.
 
I think Nikita's convinced me that we should try finding an implementation based on Closure, and refactor its internals a bit if needed. Try to make $foo->bar(?) return a specific form of closure, but still a closure. Not sure yet how this is different from Joe's previous impl.
 
Deprecation notice on callable only when used with string|array in 8.x, deprecation always in 9?
@LeviMorrison That would be cleaner. I still like the idea of then deprecating string|array with callable, but that could wait til 9.
What is the implementation issue that prevents reusing Closure?
 
Mostly that it doesn't reuse any of Closure's current internals ^_^
 
I mean… does that matter. Can that be an internal detail, but externally it's still a Closure?
 
Can partials be rebound etc?
 
7:57 PM
It does matter with regards to Closure's interface bind, bindTo, etc.
 
@LeviMorrison That then breaks the normalization ability of fromCallable(), as it would then pass a Partial through unchanged but then you can't reflect on it the same way.
 
@Crell How so?
 
@LeviMorrison Why are those invalid on a partial?
 
You have to ask this AFTER I have removed the example code from the RFC? :-(
 
@LeviMorrison We already restrict those for fromCallable() for what it's worth
Rebinding only (fully) works for proper closures
 
7:58 PM
Then... maybe I was wrong and Joe's design was actually Perfect before :) I don't know.
 
@Crell Good thing there's history. :)
 
@Crell You can revert instead of doing it manually :)
 
I ain't reverting nothing until you people figure out what you want to do in 10 years with this nice little RFC. :-(
 
@Crell The reflection part was really weird, but I'm not sure how that is inherently related to Partial extending Closure
 

« first day (3861 days earlier)      last day (1078 days later) »