Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67860 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5863 invoked from network); 26 Jun 2013 12:13:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2013 12:13:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=rstoll@tutteli.ch; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rstoll@tutteli.ch; sender-id=pass Received-SPF: pass (pb1.pair.com: domain tutteli.ch designates 80.74.154.78 as permitted sender) X-PHP-List-Original-Sender: rstoll@tutteli.ch X-Host-Fingerprint: 80.74.154.78 ns73.kreativmedia.ch Linux 2.6 Received: from [80.74.154.78] ([80.74.154.78:38472] helo=hyperion.kreativmedia.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/24-18025-00BDAC15 for ; Wed, 26 Jun 2013 08:13:53 -0400 Received: (qmail 13976 invoked from network); 26 Jun 2013 14:13:49 +0200 Received: from 99-206.5-85.cust.bluewin.ch (HELO RoLaptop) (85.5.206.99) by ns73.kreativmedia.ch with (AES128-SHA encrypted) SMTP; 26 Jun 2013 14:13:49 +0200 To: "'Peter Lind'" Cc: "'Richard Quadling'" , "'Tom Oram'" , "'PHP internals'" References: <001b01ce7263$da79fec0$8f6dfc40$@tutteli.ch> In-Reply-To: Date: Wed, 26 Jun 2013 14:13:48 +0200 Message-ID: <001f01ce7266$9d72f330$d858d990$@tutteli.ch> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0020_01CE7277.60FCAD90" X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJSSTh9my3sbZMhkjrVJdXZGpMLSwEm5OrRAbRHEOoBtaEm9ZgbsQ/Q Content-Language: de-ch Subject: AW: [PHP-DEV] RFC Proposal: New assign value operator From: rstoll@tutteli.ch ("Robert Stoll") ------=_NextPart_000_0020_01CE7277.60FCAD90 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The property is most likely private and you don=E2=80=99t have to bother = about it anyway. =20 But yes, for pure PHP users it might seems confusing since PHP variables = have no types. If you are familiar with types and operator overloading = than it is more readable IMO I assign the new price 29.99 to the variable $price What=E2=80=99s wrong with that? Is quite straight forward no? $price->setPrice(29.99); is straight forward as well IMO but your eyes = need to read more than :=3D Yet, as I said, it is a small benefit and without overloading of + - = almost negligible. =20 With + - etc. it would be possible to do things like =20 $price +=3D 1.50;=20 $price *=3D 2; =20 Etc. =20 IMO better readable than=20 =20 $price->add(1.50); $price->multiplyBy(2); =20 Cheers =20 Von: Peter Lind [mailto:peter.e.lind@gmail.com]=20 Gesendet: Mittwoch, 26. Juni 2013 14:00 An: Robert Stoll Cc: Richard Quadling; Tom Oram; PHP internals Betreff: Re: [PHP-DEV] RFC Proposal: New assign value operator =20 On 26 June 2013 13:54, Robert Stoll wrote: As far as I see it, it is kind of an operator overload mechanism for the = assign operator. This can be useful for small utility classes such as Money, Email etc. An example was given: $price =3D new MoneyValue(); $price :=3D 29.99; Instead of writing something like: $price =3D new MoneyValue(); $price->setPrice(29.99); The benefit is small, but can lead to better readable code. =20 Better readable code? It looks like you're reassigning $price, not = assigning to a property of $price. If anything it is less readable and = will lead to countless WTF moments. Just my immediate thoughts on seeing the examples. =20 Regards Peter --=20 WWW: plphp.dk / plind.dk CV: careers.stackoverflow.com/peterlind LinkedIn: plind Twitter: kafe15 =20 ------=_NextPart_000_0020_01CE7277.60FCAD90--