Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72166 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12610 invoked from network); 4 Feb 2014 03:52:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2014 03:52:17 -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.215.46 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.46 mail-la0-f46.google.com Received: from [209.85.215.46] ([209.85.215.46:54562] helo=mail-la0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/70-09069-0F360F25 for ; Mon, 03 Feb 2014 22:52:17 -0500 Received: by mail-la0-f46.google.com with SMTP id b8so5994953lan.5 for ; Mon, 03 Feb 2014 19:52: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=SWonz0ZLpiSxqphxteTc83GvJ/sJqr9zmPc5gd7KmuM=; b=lUaE3OjIAPz47NSLfVnugwk1J4RK4QndjVlNHsvO8k/E8Ot8UD2ESR8eA6XS40OH5E Xz/xjYzftKP+f/A0IdezMgD8msZ3Btmgus/hsnnEcasYCVyP6/b9By8Us7MBrKHwKNOP a0MYcaC1F9PrIGpQO3qKcV6d3yciLpJhtdTYdT6s81TslF/3nngwPAJ9DxN+8jQukQzz zWq+ihqYoElKbWH4kiS2u/3IIVc6G+J8X2UJOjrUy4o1Zl7jfHnRHQDDrg+U/i02hVru gH2zKpnAm1YuzJ5RMPz/oQdNR1whAmhGfg4k91XKmpV3EU+heT1Ko3jV5b/0wb/vNanz A7fA== X-Received: by 10.152.8.47 with SMTP id o15mr16187731laa.20.1391485932836; Mon, 03 Feb 2014 19:52:12 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.199.37 with HTTP; Mon, 3 Feb 2014 19:51:32 -0800 (PST) In-Reply-To: <52F0359E.1060707@garfieldtech.com> References: <52EF4BF8.60005@sugarcrm.com> <52EF7ADA.8090001@lsces.co.uk> <52EFF13F.4050704@sugarcrm.com> <52F0359E.1060707@garfieldtech.com> Date: Tue, 4 Feb 2014 12:51:32 +0900 X-Google-Sender-Auth: xkT-rswdhKb1j0IUgZ7HVlI1_I0 Message-ID: To: Larry Garfield Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c36402bc9c0404f18c90ab Subject: Re: [PHP-DEV] Declare minimum PHP version required? From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c36402bc9c0404f18c90ab Content-Type: text/plain; charset=UTF-8 Hi Larry, On Tue, Feb 4, 2014 at 9:34 AM, Larry Garfield wrote: > On 2/3/14 1:57 PM, Yasuo Ohgaki wrote: > >> Hi Stas, >> >> On Tue, Feb 4, 2014 at 4:42 AM, Stas Malyshev > >wrote: >> >> There are many code out there checks if (!extention_loaded(foo')) >>>> >>> die('You >>> >>>> need foo'). This is waste of CPU resources once it is checked. These >>>> requirements for scripts may be evaluated at compile time and script >>>> >>> runs a >>> >>>> little faster. >>>> >>> >>> Managing requirements is a job for package manager, like composer, not >>> language compiler, IMO. >>> >> >> >> I agree that good package manager should manage requirements. However, >> once >> code is installed, package manager will not check requirements. (Package >> manager could be made to execute requirement checks at any time, though) >> Therefore, there would be developers embed environmental checks to make >> sure not to die with function not found, etc. >> >> In addition to this, there would be SCL for RHEL7 and there are some tools >> like phpenv. Installing PHP does not have to be executing PHP. Even if >> there is good package manager, compile time requirement check is nice to >> have. It's nice to have and it's not must have, though. >> >> Regards, >> > > I have to agree with Stas and Sara on this one. This is not the job of > the language syntax. This is the package manager's job; once the code is > installed (not compiled, installed), you shouldn't be changing your version > anyway without knowing what you're doing / verifying on a test system > anyway. > > If this were more like Javascript's "use strict", where it affected the > parsing rules of that file, that would at least be useful (if potentially > mind-bendingly painful for the engine; no I'm not suggesting we do that). > But a shortcut for if (version_compare()) die; is not needed, and that > would be a dumb way to go about implementing version requirements in the > first place. This assumption is not valid as I already wrote. There will be SCL in RHEL7 and there are tools like phpenv. Installing PHP does not have to be executing PHP. Version and module requirement checks are popular and I don't think it is dumb at all. It is dumb that if script didn't work as it should be due to version mismatch, isn't it? BTW, it is not a short cut of version check, but "elimination of run time check overheads". Many people don't understand what declare() is, it seems. declare() is compiler directive, *NOT* a function. Thus it could instruct what compiler should do at compile time. Since declare() is compiler directive, compiler may omit byte code for declare block. Therefore, run time overheads of declare block may be eliminated with byte code cache. Isn't checking requirements over and over a waste of resources? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c36402bc9c0404f18c90ab--