2023-06-19 9:56 GMT+02:00, Sam McDonald <s.mcdon...@outlook.com.au>:
> Hello php internals team,
> I would like to put forward an RFC for a new feature. I am a long time user,
> but have never participated as yet to the RFC.
>
> This is my first step to gather reaction/feedback from the team.
>
> I would be happy to implement the feature and post a PR or have someone from
> the team implement this.
>
> The feature I want to put forward is "const function arguments" (same for
> methods)
>
> This feature is available in cpp, and I believe would be a benefit to the
> php community.
>
> My RFC would fully detail and clarify what this is and how it works.
>
> This feature allows the user to specify "const" on a function arg, so that
> the argument while in a function can not be reassigned.
>
> The following example would throw an exception at compile/runtime.
>
> ```
> public function foo(const int $bar)
> {
>    $bar =3D "buz";
> }
> ```

Isn't this similar to my own idea of readonly function arguments?
https://externals.io/message/120203#120210

Perhaps more limited in scope?

Olle

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to