Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59650 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15566 invoked from network); 10 Apr 2012 15:53:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Apr 2012 15:53:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=keisial@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=keisial@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.42 as permitted sender) X-PHP-List-Original-Sender: keisial@gmail.com X-Host-Fingerprint: 74.125.83.42 mail-ee0-f42.google.com Received: from [74.125.83.42] ([74.125.83.42:35500] helo=mail-ee0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/20-14507-177548F4 for ; Tue, 10 Apr 2012 11:53:21 -0400 Received: by eekb57 with SMTP id b57so1216163eek.29 for ; Tue, 10 Apr 2012 08:53:18 -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:content-transfer-encoding; bh=TTqM7lSjMMshRLDRiR9i7gOcd1OVDDG3Pjjkauwl+Tk=; b=Pg8DmowyztxFLorvU73vgVUs5JzwQOsN5iubYbdkqv1oLMgZ3dYGRlTJukTjeFrprT JsfukkvFcKHVYYIgMBR9RZEHTYorWmSZ8t9yReUMvLV9pHRFGZdFrocqVA/vU/M14Bsg SGAxvrE3nKTfbICq0QyerDx0y4fQAPgCQiTeT7mvIz+Np0hJkuTh/wz1ZgsQtJ9jtet9 eXipnSizS+TPA2X4Zwp9Q8frMfhEPvGe/2fhrv5c5t3fX5ZhfTMln0TEsbdLd0X50IrX h7n3a9F6z6KnErs9rTveYFMtjE6dskFuhis0vqhISX+DjSZFkUec4ZZx8Om6IH7k4e7b GK5Q== Received: by 10.14.37.140 with SMTP id y12mr1504942eea.120.1334072865303; Tue, 10 Apr 2012 08:47:45 -0700 (PDT) Received: from [192.168.1.26] (154.Red-83-55-229.dynamicIP.rima-tde.net. [83.55.229.154]) by mx.google.com with ESMTPS id n56sm85138729eeb.4.2012.04.10.08.47.43 (version=SSLv3 cipher=OTHER); Tue, 10 Apr 2012 08:47:44 -0700 (PDT) Message-ID: <4F84575C.2080201@gmail.com> Date: Tue, 10 Apr 2012 17:53:00 +0200 User-Agent: Thunderbird MIME-Version: 1.0 To: Chris Stockton , PHP Developers Mailing List References: <-5877502932356715576@unknownmsgid> <-3647345967307864634@unknownmsgid> <4F831FAE.2030208@ralphschindler.com> <4F8336CA.6030800@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] RFC: source files without opening tag From: keisial@gmail.com (=?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?=) Hello Chris, Chris Stockton wrote: > I am not sure I am following you here Angel, are you confusing > backwards and forward compatibility? It can probably be termed both ways, depending on which version you stay. I'm refering to the ability of a php file to work in both version 5.4 and 5.5 yet take advantage of a 5.5 feature if available. > I wouldn't expect a feature to ever work forward compatibly. > I.E. Can't use traits in php 4 and can't > play a blu ray disc in a dvd player. The introduction of a new function is a good example of compatibility. The code can easily detect and fall back function getRandomNumber() { if (function_exists('rand')) return rand(); else return 4; // chosen by fair dice roll, guaranteed to be random } or even show a graceful error message (instead of a cryptic php error): if ( version_compare(PHP_VERSION, '5.4', '<') ) die("This program requires the awesome 5.4 version of PHP"); class Foo { use Bar; ... } The later one is an example of what would *not* work, since even though the developer tried to show a clear error to the end user unexpectedly installing in an older php version than supported, he would get "PHP Parse error: syntax error, unexpected T_USE, expecting T_FUNCTION" which in no way leads them to the "You need to update PHP" conclusion. > The goal here is that if you have > a large code base which has a hand rolled include_code function > already, your change is backwards compatible with that code base. Same > to be said for any constants, which is why I recommended using the > reserved PHP_* space. The goal is to allow use of the new characteristics without having to drop support for old PHP versions, which is something typically done quite conservately. In this case, it would even be possible to make a userland include_code on old versions by falling back to an eval(). Not as good, but the codebase is still supporting the old PHP engines (back to X version).