Skip to content

[RFC] Friends#21937

Draft
DanielEScherzer wants to merge 11 commits into
php:masterfrom
DanielEScherzer:friends
Draft

[RFC] Friends#21937
DanielEScherzer wants to merge 11 commits into
php:masterfrom
DanielEScherzer:friends

Conversation

@DanielEScherzer
Copy link
Copy Markdown
Member

No description provided.

Comment thread Zend/tests/friends/property_access.phpt
@datbunneh

This comment was marked as resolved.

@DanielEScherzer

This comment was marked as outdated.

@DanielEScherzer
Copy link
Copy Markdown
Member Author

Per mailing list, updated to only allow access to protected stuff

@dalguete
Copy link
Copy Markdown

dalguete commented Jun 5, 2026

Per mailing list, updated to only allow access to protected stuff

Hey Daniel. Not sure what model is followed for the Friends feature addition, but I assume it's the C++ model, the language with most experience doing that. In that sense, making that decision of not allowing private methods/properties is incorrect. There are other languages doing similar things on different ways, buy the clearer Friends concept is the one from C++. It'd be better to follow the steps of an already proven model. (https://isocpp.org/wiki/faq/friends)

@dalguete
Copy link
Copy Markdown

dalguete commented Jun 5, 2026

Per mailing list, updated to only allow access to protected stuff

Hey Daniel. Not sure what model is followed for the Friends feature addition, but I assume it's the C++ model, the language with most experience doing that. In that sense, making that decision of not allowing private methods/properties is incorrect. There are other languages doing similar things on different ways, buy the clearer Friends concept is the one from C++. It'd be better to follow the steps of an already proven model. (https://isocpp.org/wiki/faq/friends)

Also https://www.stroustrup.com/bs_faq2.html#friend

@DanielEScherzer
Copy link
Copy Markdown
Member Author

Per mailing list, updated to only allow access to protected stuff

Hey Daniel. Not sure what model is followed for the Friends feature addition, but I assume it's the C++ model, the language with most experience doing that. In that sense, making that decision of not allowing private methods/properties is incorrect. There are other languages doing similar things on different ways, buy the clearer Friends concept is the one from C++. It'd be better to follow the steps of an already proven model. (https://isocpp.org/wiki/faq/friends)

Also https://www.stroustrup.com/bs_faq2.html#friend

Please see https://wiki.php.net/rfc/friends#access_to_private_class_parts for why private access would break things

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants