Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72187 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55015 invoked from network); 4 Feb 2014 09:09:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2014 09:09:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.179 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.179 mail-lb0-f179.google.com Received: from [209.85.217.179] ([209.85.217.179:51952] helo=mail-lb0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 87/98-09069-C3EA0F25 for ; Tue, 04 Feb 2014 04:09:17 -0500 Received: by mail-lb0-f179.google.com with SMTP id l4so6071216lbv.24 for ; Tue, 04 Feb 2014 01:09:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=VO8twNbfypF58N2Gl88VD8rYEbsfLV5aeKUGLm1bu34=; b=wpYZShoM4hBYcUbJFiYjzDC1wAMvzMGNtaFTC2Zu/v8ofFURK76ZVhOHQ7YjFLT5nf lV13HMZwyqY8si+u+JAc6Q3LFjItrM5xHkuv5HImEpQ8fRRtUaRt6kEeglt6+A10L//S VyfK0quTNxYQWWambHPldSzcdeu5s9PEP70yqJif+S2zCBIkiblMsnvRFPMJRkW6xQpU VyVIE4YipdsfTMIbKg8BCaRafuq7m/qRGkyVaa5BIST8Ih4AYD0q1ja+WN3Dha3Ph2jx 4cyniTFP2Kp8zvFKzRETf/UkD7aEmx3qWzd0PVEw/w1hDRsjl3yNyyorE9x9KileqE0u qhSw== X-Received: by 10.112.114.228 with SMTP id jj4mr9414274lbb.13.1391504952823; Tue, 04 Feb 2014 01:09:12 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Tue, 4 Feb 2014 01:08:32 -0800 (PST) In-Reply-To: References: <52EF4BF8.60005@sugarcrm.com> Date: Tue, 4 Feb 2014 18:08:32 +0900 X-Google-Sender-Auth: iaRNz6794uR2obyfyoBTJwRPulg Message-ID: To: Dmitry Stogov Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1134cbfc6a955204f190fea6 Subject: Re: [PHP-DEV] Declare minimum PHP version required? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1134cbfc6a955204f190fea6 Content-Type: text/plain; charset=UTF-8 Hi all, On Mon, Feb 3, 2014 at 7:55 PM, Yasuo Ohgaki wrote: > We may extend declare() more. For example, loaded extensions. > > declare(module='pgsql,openssl'); > > With this, we could eliminate code like > > if (!extension_loaded('foo')) { > die('You need foo module'); > } > if (!extension_loaded('bar')) { > die('You need bar module'); > } > > With opcache loaded extension check may be completely skipped. > > Evaluation at compile time and run time differs. > Similar thing could be achieved with new assert() w/o any overheads. https://wiki.php.net/rfc/expectations assert('version_compare(PHP_VERSION, "5.5.0", ">=")', 'You need PHP 5.5.0 or later'); Since assert() only accepts expression, it might be nice to have declare('assert') { if (!extension_loaded('foo')) { echo 'You need foo module'; return FALSE; } if (!extension_loaded('bar')) { echo 'You need bar module'; return FALSE } return TRUE; } Usual PHP code might be easier to write complex assertion. It may be possible to share most of the new assertion code. Just an idea. What do you think Dmitry? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a1134cbfc6a955204f190fea6--