Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57036 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83745 invoked from network); 22 Dec 2011 22:51:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2011 22:51:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=keisial@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=keisial@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.170 as permitted sender) X-PHP-List-Original-Sender: keisial@gmail.com X-Host-Fingerprint: 209.85.212.170 mail-wi0-f170.google.com Received: from [209.85.212.170] ([209.85.212.170:43872] helo=mail-wi0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/25-12618-474B3FE4 for ; Thu, 22 Dec 2011 17:51:33 -0500 Received: by wicr5 with SMTP id r5so3302085wic.29 for ; Thu, 22 Dec 2011 14:51:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=jTj3O9AfQ62xZph8NmkkoLmXQBH51QcgQe4lxH4jrWs=; b=s8hGNOM0jK46zFAg4GceMUfLLVn0yDHZNIVWN8WD6nRsETyTZ7lFBT/3pwTMdUWApS xsEvWjjlIAitLZBlUW25+IDPnWevz7zMzBXL/nWNWIDYinJqu3VSbzi4mnpogeaz/GSg Jq/CCEW9vnQHzS/o2Yr1/nQfcZ46uwVyra0l4= Received: by 10.180.90.40 with SMTP id bt8mr27512884wib.4.1324594290247; Thu, 22 Dec 2011 14:51:30 -0800 (PST) Received: from [192.168.1.26] (51.Red-83-49-113.dynamicIP.rima-tde.net. [83.49.113.51]) by mx.google.com with ESMTPS id fn3sm11355014wbb.17.2011.12.22.14.51.27 (version=SSLv3 cipher=OTHER); Thu, 22 Dec 2011 14:51:28 -0800 (PST) Message-ID: <4EF3B56A.4040809@gmail.com> Date: Thu, 22 Dec 2011 23:55:38 +0100 User-Agent: Thunderbird MIME-Version: 1.0 To: Will Fitch CC: PHP Developers Mailing List References: <2095305E-D4E3-4D7E-8218-32EE99688E0C@GMAIL.COM> <2C90FB94-38C4-4270-8C6A-B89304BA8ED8@gmail.com> <159A7CA2-8561-40DA-9434-CAAE12304DDB@gmail.com> In-Reply-To: <159A7CA2-8561-40DA-9434-CAAE12304DDB@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC From: keisial@gmail.com (=?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?=) Your examples only show class methods with visibility qualifyiers, and looking at the changes to zend_language_parser.y it seems as if would only be available for methods. Wouldn't return hints be available for plain functions? In functional programming, it is common to return nullable types: returns an instance of class Foo or null, an array or false, etc. This is supported in normal arguments with the "= null" hint, and I think there should be something equivalent for return types. Does the proposed implementation allow null everywhere? (there's an example of returning null from a return hint of array) That seems wrong to me. Unless there's a way to make it strict (eg. array! for only arrays).