Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9626 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28091 invoked by uid 1010); 1 May 2004 21:27:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 28035 invoked from network); 1 May 2004 21:27:55 -0000 Received: from unknown (HELO mirapoint.kettering.edu) (192.138.137.82) by pb1.pair.com with SMTP; 1 May 2004 21:27:55 -0000 Received: from coogle.localdomain (pcp09031773pcs.mtmors01.mi.comcast.net [68.61.83.224]) by mirapoint.kettering.edu (MOS 3.4.5-GR) with ESMTP id AOX13762 (AUTH via LOGINBEFORESMTP); Sat, 1 May 2004 17:27:54 -0400 (EDT) Reply-To: john@coggeshall.org To: Marcus Boerger Cc: PHP Internals In-Reply-To: <243202120.20040501220932@marcus-boerger.de> References: <243202120.20040501220932@marcus-boerger.de> Content-Type: text/plain Message-ID: <1083446852.2709.24.camel@coogle.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Sat, 01 May 2004 17:27:32 -0400 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Type hints From: john@coggeshall.org (John Coggeshall) I agree with the idea that it would be nice to force an instance of a particular class, etc. to be passed. However, if we are going to introduce another keyword anyway why not keep BC intact by by introducing the 'force' keyword: function myfunction(force ClassName $param, NextClass $another) { } Where 'force' would prevent $param from being passed as anything but an acceptable ClassName. Alternatively, for the sake of parsing you could do: function myfunction(Classname forced $foo) { } I remember discussing 'array' as a typehint (big +1 there), but I don't see anything gained from such a type-hint. When exactly would you use it (that you couldn't use the existing type hinting).. I guess the obvious answer is when you don't know the type of class being passed, but if you don't know that how do you plan on actually using the parameter at all? John -- -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=- John Coggeshall http://www.coggeshall.org/ The PHP Developer's Handbook http://www.php-handbook.com/ -=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-