Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61045 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88321 invoked from network); 29 Jun 2012 17:06:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jun 2012 17:06:29 -0000 Authentication-Results: pb1.pair.com header.from=pierrick@webstart.fr; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pierrick@webstart.fr; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain webstart.fr from 209.85.220.170 cause and error) X-PHP-List-Original-Sender: pierrick@webstart.fr X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:42353] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/75-62543-290EDEF4 for ; Fri, 29 Jun 2012 13:06:28 -0400 Received: by vcbgb22 with SMTP id gb22so2812097vcb.29 for ; Fri, 29 Jun 2012 10:06:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=PnIw5DBQTVow7yQomHCKIKwgJHDp0rShuhMmwnM6M8o=; b=f896tAW+CAaKB3iMuzOtLOWUclnV+X6FpGML58IJeOPuo4fLEtriDQDgOJ7yRCTsP2 YX0l5JIs++Z8blpgv8TGRxuJ7ddYw1ncaJreo0UPzJQ4iaf+EWlpbni5r9+gOv/OqkdG +zXMCZ5uDc0oPLR8VXoKb+gcGrVgb9gaILpQkmDsUX6OiG7CdF9iFLliEIVf22DvewSq TAW/bI2ZRozpPJFwC+3t9bQ16uX57wsVFonX0YcP+5rhtMnEmlbj1d6O+uFJ4U/OUk2k nqIbPApFaI+KALCpoRhe37bZM+Rv6fqGUdmfWZ2w01HUOsOQZDadEVdLvTwOWLqXXyFM bvxg== MIME-Version: 1.0 Received: by 10.52.72.44 with SMTP id a12mr1202346vdv.124.1340989584163; Fri, 29 Jun 2012 10:06:24 -0700 (PDT) Received: by 10.52.240.226 with HTTP; Fri, 29 Jun 2012 10:06:24 -0700 (PDT) In-Reply-To: References: Date: Fri, 29 Jun 2012 13:06:24 -0400 Message-ID: To: Patrick ALLAERT Cc: Amaury Bouchard , internals@lists.php.net Content-Type: multipart/alternative; boundary=20cf3071cc92cfc30904c39f778e X-Gm-Message-State: ALoCoQlHcSSS9BdFTl4Rd8hajzuRR2Y5kG9VvAk9FQNrU4iiWssYLYBX3RUkswT+JvPsCx9DpmrJ Subject: Re: [PHP-DEV] RFC proposal - Syntactic sugar for cloning From: pierrick@webstart.fr (Pierrick Charron) --20cf3071cc92cfc30904c39f778e Content-Type: text/plain; charset=ISO-8859-1 I also agree with Johannes. Pierrick On 29 June 2012 11:01, Patrick ALLAERT wrote: > 2012/6/29 Amaury Bouchard : > > 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 > > --20cf3071cc92cfc30904c39f778e--