-
Notifications
You must be signed in to change notification settings - Fork 7.8k
[RFC] Partial Function Application #6898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I'm missing a test for |
Zend/tests/partial_function/variadics-named-nested-overwrite.phpt
Outdated
Show resolved
Hide resolved
Zend/zend_partial.c
Outdated
ZVAL_PTR(&partial->This, Z_OBJCE(call->This)); | ||
|
||
GC_ADD_FLAGS(Z_OBJ(call->This), IS_OBJ_DESTRUCTOR_CALLED); | ||
OBJ_RELEASE(Z_OBJ(call->This)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So for the new Foo(?)
case, we first create an object, then destroy it and then if the partial is invoked, create another object.
This is non-great, though I'm not sure just how non-great it is. In conjunction with https://wiki.php.net/rfc/new_in_initializers it could mean that property default values get instantiated and immediately dropped again (though arguably that's an issue with that RFC).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have space for a flag, we could use IS_OBJ_CONSTRUCTOR_CALLED here and use the initial object ...
d264f87
to
61e7f1e
Compare
11123b8
to
286e16f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
} | ||
ZEND_ASSERT(0); | ||
return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation: mix of tabs and spaces.
We lost :( |
What's next? Will there be an alternative from Nikita, or your collaboration? |
Damn shame, it looks to me like a very useful feature to have. |
Implementation for https://wiki.php.net/rfc/partial_function_application