Re: [RFC] Keep type of reference params

From: Date: Sat, 09 May 2020 18:18:14 +0000
Subject: Re: [RFC] Keep type of reference params
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-110102@lists.php.net to get a copy of this message
---- En vie, 08 may 2020 15:31:52 +0200 Levi Morrison <levi.morrison@datadoghq.com> escribió ---- > I think changing reference is a bad idea, even if it's behind some > sort of declare or ini setting or what-have-you. > > I do support inout, which has similar high-level outcomes: the > current value is fed in, and when the function returns it has a new > value. I think we should use & at the call site, and we > should also > permit it optionally for by-ref parameters as it provides a migration > path: first add & to all the call sites, then switch it to > inout. Hi, Levi, Thanks for your opinion. Why don't reverse mode ?. 'inout' is created with the three characteristics: - Check type of out is equal to type of param - Avoid modifying caller variable value when the function throws an exception. ( Like inout of Hacker language ) - Allow explicit call-site pass-by-reference annotation. Then, current references are deprecated and after than, in other version, they are removed. In this way, projects can be adapted gradually Regards -- Manuel Canga

« previous php.internals (#110102) next »