Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77230 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96151 invoked from network); 15 Sep 2014 17:52:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Sep 2014 17:52:34 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.176 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com Received: from [209.85.212.176] ([209.85.212.176:33798] helo=mail-wi0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 66/D4-64534-26727145 for ; Mon, 15 Sep 2014 13:52:34 -0400 Received: by mail-wi0-f176.google.com with SMTP id ex7so4759980wid.9 for ; Mon, 15 Sep 2014 10:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=+abUiuoMpax3qMaHPHEJNHf86hgM+TSkZuzzPXXa09g=; b=GDvXc6PDi2OvItwMulv1UYJGx3+sPd0r+D/LWMKlXjGACpcmeHtWaGkdGqdec2Gaum JK3MJj9kCv6FDinOKcPYPjqZkTzlvtF+ETAZLnMnJWh0XFK3QR7ONko0OUriZPbusCUe rfSn1jNP0h/9jQrJ+vwM9kok5NziEJE/vjjXXFM0yTY9LVVhthm8oF8LFlc14RukTyoD JuwK8sYkECYRIGtwOrRSYFJgjsBXeYJM+qbSQN4p4mLCd2QPdNfJQmxXjxa6dODLxtS4 UWf36KbiNcGjT0wdBbQ50wImSH8qDxP6+iSJPTcCFQ95RcQfwq4cPyAFo2zWAne/NwVS ry8A== X-Received: by 10.194.58.41 with SMTP id n9mr29540849wjq.20.1410803547131; Mon, 15 Sep 2014 10:52:27 -0700 (PDT) Received: from [192.168.0.177] ([62.189.198.114]) by mx.google.com with ESMTPSA id fc3sm12444941wib.6.2014.09.15.10.52.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Sep 2014 10:52:26 -0700 (PDT) Message-ID: <54172756.4030903@gmail.com> Date: Mon, 15 Sep 2014 18:52:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: internals@lists.php.net References: <6893A97A-EC4C-4124-B804-96E2A26B953F@ajf.me> <541716F6.5040308@php.net> In-Reply-To: <541716F6.5040308@php.net> Content-Type: multipart/alternative; boundary="------------090508050507080809090804" Subject: Re: [PHP-DEV] [VOTE][RFC] Scalar Type Hinting with Cast From: rowan.collins@gmail.com (Rowan Collins) --------------090508050507080809090804 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sebastian Bergmann wrote (on 15/09/2014): > In any case, I think it would be best to build on the great work Nikita > did with the AST-based parser for PHP 7 and refactor the compiler to > allow reserved words as names for namespaces, classes, interfaces, ... > *before* we introduce new reserved words (and thus BC breaks). Surely, in this case, the reserved word would have to be banned as a class/interface name *anyway*, even if the parser generally allowed reserved words there? Otherwise the following is ambiguous: class Int { public function test(int $foo) { // Is this function requiring an instance of class Int, or a scalar of type int? } } If the interpretation is as a class name, then defining that class breaks all instances of scalar hinting everywhere in the current execution. Not to mention how it would interact with autoloading, reinterpreting already compiled functions, etc. If the interpretation is as an int, then the BC break exists anyway, because the keyword has to be "partially reserved", which is probably more confusing than just reserving it. I'm all for keeping the number of reserved words in a language down (cf Douglas Crockford on why JSON requires quoting on all key names), but it makes things very messy if you try not to have any at all. -- Rowan Collins [IMSoP] --------------090508050507080809090804--