Re: RFC Proposal: New assign value operator

From: Date: Wed, 26 Jun 2013 11:59:54 +0000
Subject: Re: RFC Proposal: New assign value operator
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-67858@lists.php.net to get a copy of this message
On 26 June 2013 13:54, Robert Stoll <rstoll@tutteli.ch> 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 = new MoneyValue();
> $price := 29.99;
>
> Instead of writing something like:
> $price = new MoneyValue();
> $price->setPrice(29.99);
>
> The benefit is small, but can lead to better readable code.
>

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.

Regards
Peter

-- 
<hype>
WWW: plphp.dk / plind.dk
CV: careers.stackoverflow.com/peterlind
LinkedIn: plind
Twitter: kafe15
</hype>


Thread (19 messages)

« previous php.internals (#67858) next »