Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32780 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37687 invoked by uid 1010); 15 Oct 2007 16:28:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 37661 invoked from network); 15 Oct 2007 16:28:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Oct 2007 16:28:32 -0000 Authentication-Results: pb1.pair.com header.from=dohpaz@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=dohpaz@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.146.179 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: dohpaz@gmail.com X-Host-Fingerprint: 209.85.146.179 wa-out-1112.google.com Received: from [209.85.146.179] ([209.85.146.179:2269] helo=wa-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/5A-39149-E2593174 for ; Mon, 15 Oct 2007 12:28:31 -0400 Received: by wa-out-1112.google.com with SMTP id l24so2140587waf for ; Mon, 15 Oct 2007 09:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=VDUBZuDrsnfo9AHXPg9R0BlAWXZfP35pttwv/J1INAo=; b=kWAjEQIvPsxaiyH0ydyOKCsvCo9Zy65J8/RaLuQy+g2ZuKtrLAsTPrk51vaJtkpLPNkxNOYQlrDqMzMhx86dPKJDFe8FzcIoyiGKclgfTuRYOc/Tgg/fpXfST+L9CeNkNQgY28FdGgPpbzKNHcvjN6su5ggO9gsWRiFkEPhqDG8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=LMDSlQNsSCZtZ1VlLGf3BYkL1jfYXfEp/+2n7GVcjedMNt/NY3231/dP7qoFvymM6ej7BukSH95xNIlSYhP9K6NJwhT0/VAg/GK0Cx1EU5arMLDGMM6W/L4LDUqo5IYrlvAXQu8QB9cP+Ix8vsV9A9Bmd4iM0fHw2oMyzZoezm8= Received: by 10.114.106.1 with SMTP id e1mr7182792wac.1192465706231; Mon, 15 Oct 2007 09:28:26 -0700 (PDT) Received: by 10.115.109.12 with HTTP; Mon, 15 Oct 2007 09:28:26 -0700 (PDT) Message-ID: Date: Mon, 15 Oct 2007 12:28:26 -0400 To: "Hans Moog" Cc: "Umberto Salsi" , internals@lists.php.net In-Reply-To: <7C37FF3A0196094F95430BA95952032211B7D1@s1.mkj.lan> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_33324_16948655.1192465706228" References: <7C37FF3A0196094F95430BA95952032211B7C5@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C8@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7CB@s1.mkj.lan> <4712731B.5070501@zend.com> <200710151236.l9FCaPIg014853@icosrv.icosaedro.it> <7C37FF3A0196094F95430BA95952032211B7D1@s1.mkj.lan> Subject: Re: AW: [PHP-DEV] Method overloading by method signature From: dohpaz@gmail.com ("Ken Stanley") ------=_Part_33324_16948655.1192465706228 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline FWIW, I think this is a great feature. Forgive my lack of intimate knowledg= e with the core and extension, but would this be possible as an extension to PHP? i.e., xdebug modifies how certain internals of PHP work through the zend_extension_ts ini setting. On 10/15/07, Hans Moog wrote: > > Yeah PHPLint is cool and very useful when you want to be strict. We do us= e > it regularly. But it doesn't enable you to overload your methods as > described because this could only be done by a native language construct = or > manual type checks and dispatching. > > I thought it would be a good idea to embed this into the language because > php is getting more and more object oriented and overloading functions is > one of the basic features of an object oriented programming language. > Overloading is already possible but php doesn't offer the coder a short > syntax to support him writing oveloaded functions. I would love to see a > solution for simpler overloading since that would result in a better > readability of code. > > But since I and Richard Quadling seem to be the only ones who would like > to have this feature in php, I will put no further effort in this request > and comply to the will of the majority :| > > Perhaps a later release of php will have this feature. (After all, even > namespace support was added and nobody wanted namespaces at first, becaus= e > it was not the "php way" - so there is still hope :P ) > > -----Urspr=FCngliche Nachricht----- > Von: Umberto Salsi [mailto:salsi@icosaedro.it] > Gesendet: Montag, 15. Oktober 2007 16:36 > An: internals@lists.php.net > Betreff: Re: AW: [PHP-DEV] Method overloading by method signature > > Posting to newsgroup php.internals, Stanislav Malyshev wrote: > > > > only reason to use type hints - to ensure the method is used > > > correctly and build more robust applications), it is better to tell > > > > BTW, I'm not sure how exactly it makes the code more robust - if you > > call it with wrong type and it's not checked, the app would probably di= e > > on fatal error. If you call it with wrong type and it is checked, the > > app would die on fatal error couple of lines above. Unless you use some > > kind of static analysis tool to verify your app prior to deployment (if > > you know such tools please tell me!) I don't see much difference here, > > mostly syntax sugar and enforcing right style (which is not bad - just > > it's not that big a deal). > > Most of the current applications of PHP do not need strict type checking, > and > PHP as we know today perfectly fits these needs. But debugging and > "cleaning" > large applications may become a nightmare. > > That's why I developed PHPLint, a PHP parser and validator that performs > a static analysis of the source, ensuring the safe handling of types. In > a word, this tool makes PHP very close to a strong-typed language without > the need to further complicate the interpreter with new features that > would > pervert the nature of the language. > > Every constant, variable, property has a well defined type, and every > function and method has a well defined signature that can be guessed by > PHPLint or provided through specific meta-code as in this example: > > > $i =3D 123; > # type of the variable guessed as int > > define("RND_K", 1.0 / (1.0 + getrandmax())); > # type of the constant guessed as double > > function rnd() > { > return RND_K * rand(); > } > # signature guessed as float() > > $i =3D rnd(); > # ERROR: assigning double to int > > function textToattribute(/*.string.*/ $a) > { > return "\"" . htmlspecialchars($a) . "\""; > } > # signature string(string) > > > Best regards, > ___ > /_|_\ Umberto Salsi > \/_\/ www.icosaedro.it > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > > > --=20 It looked like something resembling white marble, which was probably what it was: something resembling white marble. -- Douglas Adams, "The Hitchhikers Guide to the Galaxy" ------=_Part_33324_16948655.1192465706228--