Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62639 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82370 invoked from network); 1 Sep 2012 23:51:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Sep 2012 23:51:42 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:42186] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/6A-17065-D8F92405 for ; Sat, 01 Sep 2012 19:51:42 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id A352470003CE; Sun, 2 Sep 2012 00:51:38 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id IB8Loa5iTpyi; Sun, 2 Sep 2012 00:51:38 +0100 (WEST) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 1AD3570003CC; Sun, 2 Sep 2012 00:51:38 +0100 (WEST) Received: from damnation.nl.lo.geleia.net (unknown [IPv6:2001:470:94a2:4:21d:baff:feee:cc0b]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 43FA82006C5D; Sun, 2 Sep 2012 00:51:36 +0100 (WEST) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "Pierre Joye" , "Stas Malyshev" Cc: "PHP Internals" References: <5040DC47.8000305@ajf.me> <5040F4D9.80206@sugarcrm.com> <5042946A.80204@sugarcrm.com> Date: Sun, 02 Sep 2012 01:51:49 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: <5042946A.80204@sugarcrm.com> User-Agent: Opera Mail/12.01 (Linux) Subject: Re: [PHP-DEV] Re: Are exceptions allowed in php core? From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Sun, 02 Sep 2012 01:04:10 +0200, Stas Malyshev wrote: >>> SPL is not a part of basic language syntax. There are no SPL keywords >>> and no SPL classes used unless you explicitly instantiate those >>> classes. >>> So SPL is different. >> >> End users do not see nor buy the difference between what is Zend/ or >> what is ext/spl (or other) and can't be disabled, like SPL. > > Of course they'd see it. Here it goes again: "There are no SPL keywords > and no SPL classes used unless you explicitly instantiate those > classes". You can not just write some plain PHP syntax and end up having > SPL class. If you use SPL class, you must do "new SplSomeClass" or > something similar. It has nothing to do with disabling. This is thoroughly unconvincing. Let me see if I got this: Users do not expect exceptions in the core. They distinguish the core from the rest because the core is what they interact it when they "use only PHP syntax" (itself an odd statement, but let's let it pass). This argument has at least these shortcomings: * If users do not expect exceptions in the core, they are mistaken. There are indeed exceptions in the core. See ZEND_FE_RESET and zend_interfaces.c. Of course, no evidence has been provided one way or another. * Most ext/spl classes are not prefixed. If you ask the average PHP developer to tell between Iterator, IteratorAggregate, RecursiveIterator, ArrayAccess and Serializable, which are core and which are ext/spl, I doubt many would get the answer right. Not that they should care. * In fact, if there is a unifying theme in the usage of exceptions in PHP, is that exceptions are used when OOP interfaces are involved (see Zend interfaces, SPL, DateTime and PDO -- though optional there). The core vs. non-core argument only looks attractive because there are few built-in classes in the core. To be sure, there's one important distinction between core and ext/spl. ext/spl should depend on core, not the other way around. Which has little relevance for this discussion. -- Gustavo Lopes