Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36858 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61394 invoked from network); 7 Apr 2008 20:46:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Apr 2008 20:46:35 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.146.177 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 209.85.146.177 wa-out-1112.google.com Received: from [209.85.146.177] ([209.85.146.177:52290] helo=wa-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/8D-26449-9288AF74 for ; Mon, 07 Apr 2008 16:46:34 -0400 Received: by wa-out-1112.google.com with SMTP id l24so1298510waf.17 for ; Mon, 07 Apr 2008 13:46:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=/mhFz+lpxv8je/HKf4q6Ac9trmXIRpDDDDcds208Wcc=; b=E0wZsjQMoJvL+qu++8SsfZ15bZRv/p0IJwEP3rbpo6+NH3psvD+Jp/6GzPhA3EKC2hA38Dzo3z7wL5cIYvoqf4wH5fbbP6T6kNuho79tjsZtBqyetqXHTUJ5hH1dHxXqJB7I5nT70T1pVSh6x8ZknDq7t3YsFYZ3cWQLISdUepU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=NCmjEc4bYCxhrgEOyq5j84OQHnCd8sibHhbx5u44+fB9I2Br532X10sjvo50RLgdSZYgeVy5hd1zLUbjTnwJFUPex2sX/5we4lnH+qSFuY2gnRXyxgeBOHtZTa5M7CVelRjaHVjxo+FXVxoRcrqRTI/sxwZw5oPh7728Wn1YKkE= Received: by 10.114.73.3 with SMTP id v3mr429877waa.218.1207601191219; Mon, 07 Apr 2008 13:46:31 -0700 (PDT) Received: by 10.114.209.15 with HTTP; Mon, 7 Apr 2008 13:46:31 -0700 (PDT) Message-ID: <10845a340804071346m251eae49j907b4a6ca7c607be@mail.gmail.com> Date: Mon, 7 Apr 2008 21:46:31 +0100 Reply-To: RQuadling@GoogleMail.com To: "Christian Schneider" Cc: "Felipe Pena" , internals@lists.php.net In-Reply-To: <47FA507D.2070108@cschneid.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1207539695.5736.42.camel@pena> <8d7b8c130804062157j60871630r6c3b27c4d3245cb9@mail.gmail.com> <1207576676.5331.49.camel@felipe> <47FA507D.2070108@cschneid.com> Subject: Re: [PHP-DEV] Return type hints From: rquadling@googlemail.com ("Richard Quadling") On 07/04/2008, Christian Schneider wrote: > Just so this side was mentioned once again too: There are people who > consider type hints and especially scalar type hints A Bad Thing(tm) as > it is contrary to the PHP strength of dynamic typing and automatic type > conversion. We are told that user data is dirty. Cleaning it is essential. One of the simplest ways is to cast the data to the right type. If they enter a date, then make sure it is a date by converting it to a date - if it can't convert then it wasn't a date. Why would you retain the string as your PRIMARY value? If you intend to do date manipulation you have to convert it. To use scalars they have to be in the right type. I cannot take 2 days from a string which is a date without having to do some conversion. The net result is that most user data should end up in the correct type anyway. So at what stage does this dynamic juggling of scalars take place? And why is it considered non-dynamic having a function declaration tell third party developers the scalar type of the parameters should be? If it was truly dynamic, they would be juggled for me rather than have me do it in userland. About the only time juggling is effective is in string concatenation. And even then it misses booleans! Do I get "true"/"false"? No I get nothing or 1. So I have to process it. Type juggling just doesn't seem to fit well with me. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"