Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44888 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90711 invoked from network); 10 Jul 2009 01:03:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jul 2009 01:03:37 -0000 X-Host-Fingerprint: 99.189.103.1 99-189-103-1.lightspeed.tulsok.sbcglobal.net Received: from [99.189.103.1] ([99.189.103.1:25306] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2B/30-23850-963965A4 for ; Thu, 09 Jul 2009 21:03:37 -0400 Message-ID: <2B.30.23850.963965A4@pb1.pair.com> To: internals@lists.php.net Date: Thu, 09 Jul 2009 20:03:34 -0500 User-Agent: Thunderbird 2.0.0.18 (Windows/20081105) MIME-Version: 1.0 References: <7.0.1.0.2.20090708224156.0ac5a438@zend.com> <312025EF-84D0-4411-A0A7-4F0379C3105F@pooteeweet.org> <22CAD497EA2F476DAECEF9302D0B087A@pc> <98b8086f0907091150r47e7a103jaa50fcf7d5b32186@mail.gmail.com> <4A568B33.9000501@gmail.com> <98b8086f0907091744w7ab598dckc427d0a9484664b2@mail.gmail.com> In-Reply-To: <98b8086f0907091744w7ab598dckc427d0a9484664b2@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 090709-0, 07/09/2009), Outbound message X-Antivirus-Status: Clean X-Posted-By: 99.189.103.1 Subject: Re: [PHP-DEV] Type hinting - Request for Discussion From: spam.goes.in.here@gmail.com (Josh Thompson) troels knak-nielsen wrote: >> - How do you know if it is a contract or the current object type hint? > > The simplest solution would be to make one take precedence. You're not > likely to have both a class and a function with the same name, and if > you do, you kind of had it coming to you. For backwards compatibility > it would probably be most fitting to let the current behaviour > (class/interface) take precedence, although the other way around makes > for some quite interesting possibilities. > I would much rather be explicit with a different syntax, that way we don't have to add a new set of resolution rules. For example what would this do to autoload? Would we have to call it to see if the class is available every time? I think the function syntax disambiguates things and hints at what is happening. >> - It doesn't allow a type to be forced (casted) to the correct type. > > As far as I can tell, this is a moot point. The whole discussion about > casting comes from the fact that hinting to a primitive type is more > restrictive than php's weak typing system. With a contract system this > problem doesn't exist. You could test that something conforms to your > specifications and then simply let the type system do its thing. > I can concede on this point. I just thought there might be some reason you would need it in a specific type, but none are coming to mind... -- Joshua Thompson Mechanical Engineer/Software Developer http://www.schmalls.com