On Fri, 8 May 2020 at 13:04, Thomas Gutbier <thomas.gutb...@anthrotec.de> wrote:
> Am 08.05.2020 um 12:37 schrieb G. P. B.: > > I think everyone can agree this is useful. But the issue here is the > > implementation. Because from what I know PHP's references are aspecial > > kind of pain in the engine. > > > > That's why the common wisdom is to use references in PHP as least as > possible. > > And IIRC what you are trying to achieve would need a major overhaul of > how > > references work and someone who wanted to tackle this would have done it > on > > their own and propose an RFC at the same time. > > > > So sadly unless something semi-concrete shows up, I'm considering this a > > pipe dream. > > But I'd gladly be shown otherwise. > > Isn't that already solved for typed properties? > > Consider this: > > class A { public static int $number = 5; } > $num = &A::$number; > $num = "String"; > > This will result in an uncaught TypeError, > see https://3v4l.org/XC6hk > > I would think, it would be consistent if referenced parameters > behaved in exactly the same way. > > Regards, > Thomas > Indeed, I forgot that typed references properties for classes were a thing now. It does make this way less of a pipe dream and something achievable, but I would imagine this not to be trivially implemented/extended to accommodate this. Moreover, although this is bad design IMHO, but some people may rely on this weird feature, which brings back the whole how to handle BC question. I for one, would be in favour of burning this into the ground but I don't know how others feel. Best regards George P. Banyard >