Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44664 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73155 invoked from network); 2 Jul 2009 15:19:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2009 15:19:53 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.117 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.117 us-mr1.zend.com Linux 2.4/2.6 Received: from [63.205.162.117] ([63.205.162.117:34248] helo=us-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/D0-03575-610DC4A4 for ; Thu, 02 Jul 2009 11:19:51 -0400 Received: from us-gw1.zend.com (us-ex1.zend.net [192.168.16.5]) by us-mr1.zend.com (Postfix) with ESMTP id D3032E12BB for ; Thu, 2 Jul 2009 08:08:44 -0700 (PDT) Received: from [192.168.27.29] ([192.168.27.29]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 2 Jul 2009 08:20:25 -0700 Message-ID: <4A4CD013.7030108@zend.com> Date: Thu, 02 Jul 2009 08:19:47 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: Paul Biggar CC: PHP Internals References: <4A4C61A1.1090602@zend.com> <4A4C6F6C.5030901@zend.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Jul 2009 15:20:25.0456 (UTC) FILETIME=[9FC59700:01C9FB28] Subject: Re: [PHP-DEV] Re: Flexible type hinting From: stas@zend.com (Stanislav Malyshev) Hi! > Are optional argument specifications inherited? I did not think they > were, but its not clear if you are saying they are. Of course they are - how couldn't they be, they are part of method definition. > My understanding of PHP's optional arguments is that they only apply > to a function once it is called. Yes, but it doesn't prevent them from being part of inheritance logic. if you have foo($a = 1) then you can't override it with foo($a) - it violates LSP (imagine somebody calling $a->foo()). >> And it is doing something - if >> you declare interface as foo(int $a) and implement it as foo(string $a) >> there may be a lot of WTF happening. > > I mean that it is never called, therefore the type hints are not > checked, and this is fine. But it is called! The whole point of the interface is to call it - i.e. to have code use the fact that you can be sure to have foo(int $a) in some object of some unknown class. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com