Skip to content
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

Document stubs #13677

Merged
merged 10 commits into from
May 29, 2024
Merged

Document stubs #13677

merged 10 commits into from
May 29, 2024

Conversation

kocsismate
Copy link
Member

@kocsismate kocsismate commented Mar 11, 2024

I'm not a good writer, so feel free to suggest better wording/rephrase the text wherever needed :)

@kocsismate kocsismate added the Category: Documentation This is for documentation inside php-src, not on php.net label Mar 11, 2024
@kocsismate kocsismate force-pushed the stub-docs branch 3 times, most recently from c6c16d2 to 90b2a67 Compare March 11, 2024 22:22
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

Thank you! I did read this in detail. There are some grammatical oddities, but I'm not sure code reviews are a good tool to fix those.

Please check the README on how to auto-format the files.

Thank you for providing some documentation on the frameless calls 🙂

Stubs
#################

Stub files are pieces of plain PHP code which only contain declarations without actually runnable code. A very basic stub
Copy link
Member

Choose a reason for hiding this comment

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

I think you should start out explaining what problem stubs solve exactly, along with maybe a simple example of a stub and a function implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll try to come up with a better intro.. I also felt that the current one is not very good :D

docs/source/miscellaneous/stubs.rst Show resolved Hide resolved
compile-time. The feature internally works by adding the ``ZEND_ACC_COMPILE_TIME_EVAL`` function flag.

As of PHP 8.4, the concept of arity-based frameless functions was introduced. This is another optimization technique,
which results in faster internal function calls by eliminating unnecessary checks for the number of passed parameters
Copy link
Member

Choose a reason for hiding this comment

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

Mostly, it is about not creating a stack frame, but passing arguments to the function directly via the ICALL operands. Hence the name "frameless".

@kocsismate
Copy link
Member Author

Thank you! I did read this in detail. There are some grammatical oddities, but I'm not sure code reviews are a good tool to fix those.

Feel free to point these out/suggest a better wording, and I'll try to fix them! I wouldn't want to provide docs which scares native speakers.

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

Mostly looks good just some nits

docs/source/miscellaneous/stubs.rst Outdated Show resolved Hide resolved
docs/source/miscellaneous/stubs.rst Outdated Show resolved Hide resolved
docs/source/miscellaneous/stubs.rst Show resolved Hide resolved
docs/source/miscellaneous/stubs.rst Outdated Show resolved Hide resolved
docs/source/miscellaneous/stubs.rst Outdated Show resolved Hide resolved
docs/source/miscellaneous/stubs.rst Outdated Show resolved Hide resolved
@derickr
Copy link
Member

derickr commented Mar 18, 2024

I could do quite a bit to make this easier to read — but would it make sense if I spend an hour on it?

@kocsismate
Copy link
Member Author

@derickr just a gentle ping: will you have capacity on improving the wording in the near future?

@kocsismate
Copy link
Member Author

With the help of Derick, the documentation was revamped :)

Copy link
Member

@Girgias Girgias left a comment

Choose a reason for hiding this comment

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

LGTM

@kocsismate kocsismate merged commit 0f64901 into php:master May 29, 2024
5 checks passed
@kocsismate kocsismate deleted the stub-docs branch May 29, 2024 12:18
@kocsismate
Copy link
Member Author

@iluuu1994 If you have followup suggestions, or anything comes to your mind which should be improved, feel free to reach out to me!

@kocsismate
Copy link
Member Author

The documentation is now live at https://php.github.io/php-src/miscellaneous/stubs.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Documentation This is for documentation inside php-src, not on php.net
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants