Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37005 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62673 invoked from network); 14 Apr 2008 17:04:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Apr 2008 17:04:28 -0000 Authentication-Results: pb1.pair.com header.from=chrisstocktonaz@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=chrisstocktonaz@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.200.175 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: chrisstocktonaz@gmail.com X-Host-Fingerprint: 209.85.200.175 wf-out-1314.google.com Received: from [209.85.200.175] ([209.85.200.175:62365] helo=wf-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/1A-11147-A9E83084 for ; Mon, 14 Apr 2008 13:04:28 -0400 Received: by wf-out-1314.google.com with SMTP id 27so1678003wfd.26 for ; Mon, 14 Apr 2008 10:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=jtmL7NhGQY2n01rd8cqzg51+UICnmeBIjwRFpDttf8s=; b=tKiwZORXjS1QtnLWxWFM4K8N7hnPMfCFc+/0eS2JMjeNEfIrmKKalT/Tk03a0yb+dxmwv/6ARp+sBDTtwSLNxvVuCkgxz9octH7Ap7sRE5bdlZ1GkmIZpOTzwusvok0LsCl2RCQZ9963uVb9XMM2FuU5lxaVVDCnvZftkqsKERE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=N6I8kemJZPBRPQfoidylEq9kkZVzkwheBIrVBGUH8MyWiIwzt6GbmV8V2xx87N+Hq7vIEtrNb7lb/OErjicmd8IjXIwl8fxR+hYFfEjmWIzBwqLK7DengBtHPYuJNVecNjBoOv/Mx8sB68h4ndBq5buYeXq8XGKg5HWW1/GvEFg= Received: by 10.142.89.9 with SMTP id m9mr1899167wfb.35.1208192663888; Mon, 14 Apr 2008 10:04:23 -0700 (PDT) Received: by 10.142.186.20 with HTTP; Mon, 14 Apr 2008 10:04:23 -0700 (PDT) Message-ID: Date: Mon, 14 Apr 2008 10:04:23 -0700 To: "Christian Schneider" Cc: internals@lists.php.net In-Reply-To: <48036A0C.7070203@cschneid.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6004_3453544.1208192663881" References: <1207539695.5736.42.camel@pena> <8d7b8c130804062157j60871630r6c3b27c4d3245cb9@mail.gmail.com> <1207576676.5331.49.camel@felipe> <47FA507D.2070108@cschneid.com> <5CB53203-F3E5-46F2-89A8-F331B2CB9017@pooteeweet.org> <47FA60F8.7060702@zend.com> <37C655F0-D212-420C-9320-7953A69C5EDB@pooteeweet.org> <48036A0C.7070203@cschneid.com> Subject: Re: [PHP-DEV] Return type hints From: chrisstocktonaz@gmail.com ("Chris Stockton") ------=_Part_6004_3453544.1208192663881 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline You are missing the point, why be strict on return types, and liberal on parameters? Be strict consistently or be liberal consistently. Or, keep php, php. I could care less as long as things are consistent, although I think only supporting scalar is silly regardless of type juggling. -Chris On Mon, Apr 14, 2008 at 7:28 AM, Christian Schneider wrote: > Chris Stockton schrieb: > > Why on earth would you have int, string, resource, etc "return type > > hints" > > and then turn around and suggest for parameter hinting just add a scalar > > type? That makes no sense and is so inconsistent. > > > > static int function retarded(scalar $value) { > > return (int) $value; // lol.... > > } > > > > Let me turn your question around: Why on earth would someone restrict a > function to int when string works just as well? > > function int foo_flexible(scalar $x) { return $x + 42; } > $foo = foo_flexible($value); > > function int foo_retarded(int $x) { return $x + 42; } > $foo = foo_retarded((int)$value); # :-( > > That said, I'll be using > function foo($x) { return $x + 42; } > anyway and let PHP warnings take care of the rest ;-) > > - Chris > > ------=_Part_6004_3453544.1208192663881--