Re: [RFC] Explicit call-site send-by-ref syntax

From: Date: Tue, 12 Dec 2017 07:51:42 +0000
Subject: Re: [RFC] Explicit call-site send-by-ref syntax
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-101332@lists.php.net to get a copy of this message
Hi! > The issue, as you well know, is that references disable copy-on-write. Thus assume you have > code like this: > > function with_ref(&$a) { > count ($a); > } > > function no_ref($a) { > count($a); > } > > The count in with_ref() will copy the array, while no_ref() can use copy on write and > won't actually copy. Yes, this is an issue, and it'd be good to find a way to solve it. At least for count() and other "pure" (however pure can it be in PHP) functions it seems possible. But do not think "not using references ever" qualifies as a solution :) -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#101332) next »