Re: function call chaining
| From: | Alain Williams | Date: | Tue, 19 Jan 2010 11:19:36 +0000 |
| Subject: | Re: function call chaining | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46799@lists.php.net to get a copy of this message | ||
On Tue, Jan 19, 2010 at 01:55:32PM +0300, Alexey Zakhlestin wrote:
>
> On 19.01.2010, at 13:47, Christian Schneider wrote:
>
> > Alexey Zakhlestin wrote:
> >> Would be nice if something like this worked too:
> >> (new Class())->method();
> >
> > If you *really* want to do this you can use a factory method:
> > Class::create()->method();
>
> I know. That's what I do if I need it.
> Or just create temporary variable
>
> But, still, I want consistent syntax, which doesn't put limitations on me
> this construct is an example of things, which many people take for granted and are shocked,
> when they discover, that they can't use it.
> I saw a lot of questions on forums regarding it
I am in favour of such things and get annoyed when it doesn't work.
I get annoyed because things like this don't work:
$a = '0123456789'[$i];
But I come from a C background and am a competent programmer.
I have seen the argument that things like this will confuse novice programmers,
maybe: but would they ever try to type something like that ?
--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
Past chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h>