I also agree with Johannes. Pierrick
On 29 June 2012 11:01, Patrick ALLAERT <patrickalla...@php.net> wrote: > 2012/6/29 Amaury Bouchard <ama...@amaury.net>: > > Hello everybody, > > > > It's the first time I write on the internals mailing-list, so let me > > introduce myself quickly. I'm a french and canadian CTO, working in > Paris. > > I lead some PHP projects (mainly the Temma framework and FineFS data > > replication system). > > I begin to learn PHP's internal engine, backed by Pierrick Charron. > > > > I would like to do an RFC proposal (see below for the associated patch). > > I was thinking about "what if PHP was a full-object language?". Like, for > > example, how will we write the simplest code, assuming that objects are > > handled using pointers since PHP 5. > > > > Take a look at this code: > > $a = 3; > > $b = $a; > > $a++; > > > > $b still contains the value 3. > > > > Now, if we imagine that even the integer data type is managed in an > object, > > the same code will produce two pointers to the same object. Thus, $b will > > have the value 4, as $a. > > So, in this imaginary world, we would need to do a lot of object > cloning. I > > wondered how this could be less painful, and I thought about the Pascal > > language's affectation operator (:=). > > > > Then we would be able to write something like that: > > $a = 3; > > $b := $a; > > $c = $a; > > $a++; > > > > $a equals 4, as $c. But $b equals 3. > > > > Back in the real world, we are not cloning objects very often. But, like > > many other syntactic sugars (as the short array syntax), I think it could > > be handy in some circumstances. > > > > There is a patch for this evolution, written by Pierrick. > > Full source code: https://github.com/adoy/php-src/tree/amaury-clone > > Code diff: > > > https://github.com/adoy/php-src/commit/5107c0355c50381c7e67230cdc9f563eb3936a15 > > > > > > I'm looking forward to your advices. > > > > Cheers! > > > > Amaury > > Hi Amaury, > > I have to agree with Johannes here, it looks like a benefit only in a > very few cases but introduces a lot of side changes like IDE syntax > parsing, to cite only one. > I really doubt the little benefit of such a change outperforms the > extra work involved. > > Cheers, > Patrick > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >