Re: [RFC] new foo()->bar()
| From: | Peter Lind | Date: | Sat, 27 Nov 2010 05:28:46 +0000 |
| Subject: | Re: [RFC] new foo()->bar() | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-50617@lists.php.net to get a copy of this message | ||
On Friday, November 26, 2010, Gustavo Lopes <glopes@nebm.ist.utl.pt> wrote:
> On Fri, 26 Nov 2010 20:25:32 -0000, Peter Lind <peter.e.lind@gmail.com> wrote:
>
>
> It seems fairly handy and I've been in situations where I wanted to do
> something like that - in fact, I use factories to achieve something
> similar.
> However, the more I use it, the more it feels like introducing code
> smells into my code. You're essentially instantiating an object only
> to immediately throw it away.
>
>
> Not necessarily; you could be calling the method for the collateral effects and that method
> return the object itself. This is not that uncommon.
>
And I can do that today with a factory pattern, if I want to.
Anyway, I don't want to argue against the feature, as it will just
introduce a slightly shorter version of something we can already do.
--
<hype>
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
</hype>