Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32810 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11100 invoked by uid 1010); 16 Oct 2007 10:19:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 11085 invoked from network); 16 Oct 2007 10:19:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Oct 2007 10:19:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=hans.moog@mkj-computing.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=hans.moog@mkj-computing.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mkj-computing.de from 213.239.209.74 cause and error) X-PHP-List-Original-Sender: hans.moog@mkj-computing.de X-Host-Fingerprint: 213.239.209.74 web-002.server-ip.de Linux 2.4/2.6 Received: from [213.239.209.74] ([213.239.209.74:53111] helo=web-002.server-ip.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/12-29600-32094174 for ; Tue, 16 Oct 2007 06:19:16 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by web-002.server-ip.de (Postfix) with ESMTP id 533167D806A; Tue, 16 Oct 2007 12:17:47 +0200 (CEST) Received: from web-002.server-ip.de ([127.0.0.1]) by localhost (web-002.server-ip.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03210-03; Tue, 16 Oct 2007 12:17:46 +0200 (CEST) Received: from win-001.server-ip.de (static.88-198-106-164.clients.your-server.de [88.198.106.164]) by web-002.server-ip.de (Postfix) with ESMTP id E0D217D8054; Tue, 16 Oct 2007 12:17:46 +0200 (CEST) Date: Tue, 16 Oct 2007 12:19:12 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C80FDD.FF16713D" Message-ID: <7C37FF3A0196094F95430BA95952032201611B@s1.mkj.lan> X-MS-Has-Attach: Content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.5 X-MS-TNEF-Correlator: Thread-Topic: AW: [PHP-DEV] Method overloading by method signature thread-index: AcgP2f4jIo6xhnVvT4u+vjvazEXPXQAAwDkt References: <7C37FF3A0196094F95430BA95952032211B7C5@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> <72129346.20071014092922@marcus-boerger.de> <7C37FF3A0196094F95430BA95952032211B7CC@s1.mkj.lan> <19939840.20071014231353@marcus-boerger.de> <002f01c80f5b$d645d340$15b2a8c0@unterwegs> <7C37FF3A0196094F95430BA95952032211B7D2@s1.mkj.lan> <4714881F.1030302@cschneid.com> To: "Christian Schneider" Cc: X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mkj-computing.com, mkj-computing.de Subject: AW: AW: [PHP-DEV] Method overloading by method signature From: hans.moog@mkj-computing.de ("Hans Moog") ------_=_NextPart_001_01C80FDD.FF16713D Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable And if you have more than one parameter you will name it = methodFromStringIntegerSampleClassBoolean ?!? And how would you do the same for constructors ?!? Create a = initWithStringIntegerSampleClassBoolean method which has to be called = after object creation ?!? -----Urspr=FCngliche Nachricht----- Von: Christian Schneider [mailto:cschneid@cschneid.com] Gesendet: Di 16.10.2007 11:45 An: Hans Moog Cc: internals@lists.php.net Betreff: Re: AW: [PHP-DEV] Method overloading by method signature =20 Hans Moog wrote: > When it would be: >=20 > =3D=3D > function xpath(DomDocument $arg) { > return new DomXPath($arg); > } >=20 > function xpath(XmlTree $arg) { > return new DomXPath($this->loadXML($arg->getSource()))); > } >=20 > function xpath(string $arg) { > return new DomXPath($this->loadXML($arg)); > } > =3D=3D function xpathFromDom($arg) { return new DomXPath($arg); } function xpathFromTree($arg) { return new DomXPath($this->loadXML($arg->getSource()))); } function xpathFromString($arg) { return new DomXPath($this->loadXML($arg)); } Works perfectly well. And you don't even need to document them because=20 the names speak for themselves. A much simpler (and clearer) solution = IMHO. If you want an OO way I'd prefer something like $xpath =3D $obj->getXPath(); to $xpath =3D $this->xpath($obj); anyway. This doesn't work with basic types like strings but having a=20 special case there is not a problem IMHO as using those two=20 interchangeably will lead to other problems anyway. - Chris ------_=_NextPart_001_01C80FDD.FF16713D--