Re: __clone() implementation
| From: | Adam Maccabee Trachtenberg | Date: | Mon, 02 Feb 2004 20:09:09 +0000 |
| Subject: | Re: __clone() implementation | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-7491@lists.php.net to get a copy of this message | ||
On Mon, 2 Feb 2004, Andi Gutmans wrote:
> At 02:42 PM 2/2/2004 -0500, George Schlossnagle wrote:
> >If you force the parameter to be name $that, what's the point of requiring
> >it to be passed at all? Seems analogous to having all methods be required
> >to pass $this as their first parameter.
>
> Because it's a good way of retrieving the to-be-cloned object (no behind
> the scenes magic), and in my opinion, it's cleaner because everyone's clone
> functions will look the same and it'll make it easier to understand them.
> Why do you care so much if it's called $that or $foobar?
> What is important is that the problems with clone are fixed (almost). And
> you now have a consistent way of calling the parent clone method if you
> choose to.
I don't think George really objects to the name itself as much as he's
wondering why it has to have a fixed name at all.
Forcing an argument to have a specific name really seems inconsistent
with everything else in the language. Following the same logic, we
also should make __get() and __set() have fixed parameter names, but I
don't see anyone arguing for that.
-adam
--
adam@trachtenberg.com
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!