Skip to content

Closure::call()#775

Merged
php-pulls merged 20 commits into
php:masterfrom
hikari-no-yume:Closure_apply
Aug 27, 2014
Merged

Closure::call()#775
php-pulls merged 20 commits into
php:masterfrom
hikari-no-yume:Closure_apply

Conversation

@hikari-no-yume

Copy link
Copy Markdown
Contributor

The pull request of the RFC: https://wiki.php.net/rfc/closure_apply

Comment thread Zend/tests/closure_040.phpt Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you change %d here? by accident?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially yes, but I don't think you should use %d with line numbers as they're not going to change.

Comment thread Zend/zend_closures.c Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simply return; here is enough(it's a tradition :)

@php-pulls php-pulls merged commit 2cdd5ba into php:master Aug 27, 2014
@hikari-no-yume

Copy link
Copy Markdown
Contributor Author

@laruence zend_stdint.h doesn't exist, and we're supposed to use php_stdint.h for uint32_t.

@hikari-no-yume

Copy link
Copy Markdown
Contributor Author

Also, uint32_t is the type of param_count. Why should I use int?

@datibbaw

Copy link
Copy Markdown
Contributor

@TazeTSchnitzel Because of the this ;-)

@hikari-no-yume

Copy link
Copy Markdown
Contributor Author

@datibbaw zpp is wrong though, you're almost always calling it with &fci.param_count, which is a uint32_t. We should fix zpp, not my code.

@laruence

Copy link
Copy Markdown
Member

@TazeTSchnitzel in that case, I would like make fci.param_count as int instead of include a php/stdint.h into Zend...

@laruence

Copy link
Copy Markdown
Member

or , maybe use zend_long.h here. (it depends on stdint.h now, I will definitely ask welting to re-think about it)

@laruence

Copy link
Copy Markdown
Member

anyway, please, use int for now... and do not include "dependence out of Zend"

@nikic

nikic commented Aug 27, 2014

Copy link
Copy Markdown
Member

zend.h already includes the stdint header. You can use uint32_t here without any additional includes.

@hikari-no-yume

Copy link
Copy Markdown
Contributor Author

@nikic Shouldn't I explicitly include what I use, rather than relying on zend.h happening to include a billion headers?

@nikic

nikic commented Aug 27, 2014

Copy link
Copy Markdown
Member

zend_closure.c already includes zend.h. Source files should pretty much always include it.

@hikari-no-yume

Copy link
Copy Markdown
Contributor Author

@nikic That's not my point. Surely I should still include it explicitly rather than relying on zend.h happening to include it?

@nikic

nikic commented Aug 27, 2014

Copy link
Copy Markdown
Member

No, you should not include it explicitly. Only include the files that are not present in zend.h.

@hikari-no-yume

Copy link
Copy Markdown
Contributor Author

@nikic Ah, fair enough.

@laruence

Copy link
Copy Markdown
Member

great, then problem gone..

@hikari-no-yume

Copy link
Copy Markdown
Contributor Author

Fixed incorrect names in NEWS and UPGRADING identified by @thekid: 87c28cc

@thekid

thekid commented Oct 25, 2014

Copy link
Copy Markdown
Contributor

Fixed incorrect names in NEWS and UPGRADING

👍

Comment thread NEWS

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code says Closure:call(). Following JavaScript it should be called apply() and a varargs version should be calles call().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's called call for consistency with JS. JS's call isn't varargs. JS's apply is.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, misunderstood the implementation. Still, the NEWS file needs fixing. Do you plan on adding apply as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NEWS file was already fixed. And there's no need for apply, given we have splats.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants