Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70537 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68778 invoked from network); 8 Dec 2013 18:07:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Dec 2013 18:07:57 -0000 Authentication-Results: pb1.pair.com header.from=ellison.terry@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ellison.terry@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.173 as permitted sender) X-PHP-List-Original-Sender: ellison.terry@gmail.com X-Host-Fingerprint: 209.85.212.173 mail-wi0-f173.google.com Received: from [209.85.212.173] ([209.85.212.173:47769] helo=mail-wi0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/C9-01020-C75B4A25 for ; Sun, 08 Dec 2013 13:07:57 -0500 Received: by mail-wi0-f173.google.com with SMTP id hn9so2842393wib.6 for ; Sun, 08 Dec 2013 10:07:54 -0800 (PST) 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=uXxtOmpgCDdarGGxFtpzLDsKBhylSm06+DjCwH0sYdQ=; b=EDXRvPinJYuDhW6/jV4mZCdOahX1+4XNGy6UeQruNiM1doIk3xiI18i/T7SGB0OdXj UUaIaRdUGWMezanYYn8u7XHJAa8HkcX6Cxr2BKntiSwkzIWC7PBRvUPysrFqPOVxhBLe Y4aanRHMqDG9wRMRIcTtOVvLfFRK8rzi/CXdnDUyYbzmi5YmabO16q3jCHjGSOQi2Nfi mlZ7Ikyz17FTU4hvCpdVB9ya03vPf6YNv1bqfcPKc5edDsToN9Xf5VSVCs956TpJtzP6 CvkYK8xeS22QJ5kHPx5GYtUJw3W11uPigrmOspobq5zmodDGpud9fm9WSL85VsZhs1hV qjgA== X-Received: by 10.180.74.174 with SMTP id u14mr10821197wiv.45.1386526074280; Sun, 08 Dec 2013 10:07:54 -0800 (PST) Received: from [192.168.1.91] (host81-152-194-204.range81-152.btcentralplus.com. [81.152.194.204]) by mx.google.com with ESMTPSA id fu1sm17129411wib.8.2013.12.08.10.07.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Dec 2013 10:07:53 -0800 (PST) Message-ID: <52A4B578.8060704@gmail.com> Date: Sun, 08 Dec 2013 18:07:52 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: Alexey Zakhlestin , PHP Internals References: <52A4A6A1.3080206@gmail.com> <52A4A8DD.60106@gmail.com> In-Reply-To: <52A4A8DD.60106@gmail.com> Content-Type: multipart/alternative; boundary="------------090703080001050701040303" Subject: Re: [PHP-DEV] Introducing pragmas into PHP? From: ellison.terry@gmail.com (Terry Ellison) --------------090703080001050701040303 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 08/12/13 17:14, Alexey Zakhlestin wrote: >> I am suggestion the overload of constants of the form PHP_PRAGMA_XXX to >> define PHP / Zend compiler / executor behaviours. This approach would be >> BC to 5.3 unless, of course, the application already used PHP_PRAGMA_* >> constants, in which case we might also need an allow_php_pragmas INI >> parameter to globally enable/disable their interpretation. > we already have declare() for this purpose exactly. > http://docs.php.net/declare > > it might make sense to use it for more things Alexey, perhaps you missed the subtlety of my example: namespace fred; const PHP_PRAGMA_ALLOW_OVERRIDE_BUILTINS=false; echo strlen("DDDD"); define() is a runtime function implemented by Zend/zend_builtin_functions.c:ZEND_FUNCTION(define). The constant which is defines is not available until the DO_FCALL_BY_NAME opcode is itself executed sometime *after* the compile of the current source completes. const is a syntactic construct that can be intercepted in zend_compile.c, etc., and therefore can condition the remainder of the compile of that source. That's what pragmas do. However, you are quite correct that: define('fred\PHP_PRAGMA_ALLOW_OVERRIDE_BUILTINS', false); include "some_other_php_file_in_namespace_fred.php"; ... would set the pragma for subsequent source scripts in the "fred" namespace, if we adopted this convention. Hope this helps. Terry --------------090703080001050701040303--