Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79090 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33506 invoked from network); 21 Nov 2014 16:55:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Nov 2014 16:55:27 -0000 Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 78.32.209.33 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 78.32.209.33 freshmint.phcomp.co.uk Received: from [78.32.209.33] ([78.32.209.33:46909] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/81-26013-E7E6F645 for ; Fri, 21 Nov 2014 11:55:27 -0500 Received: from addw by mint.phcomp.co.uk with local (Exim 4.72) (envelope-from ) id 1XrrUR-0003eQ-40 for internals@lists.php.net; Fri, 21 Nov 2014 16:55:23 +0000 Date: Fri, 21 Nov 2014 16:55:23 +0000 To: PHP Internals Message-ID: <20141121165522.GA7217@phcomp.co.uk> Mail-Followup-To: PHP Internals References: <546C9E22.6090301@fedoraproject.org> <20141119134632.GV2294@phcomp.co.uk> <546CA8C0.1060707@gmail.com> <20141119150713.GY2294@phcomp.co.uk> <4183E34B-0A7A-484E-8A04-411A309F4291@ajf.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Parliament Hill Computers Ltd User-Agent: Mutt/1.5.20 (2009-12-10) Subject: Re: [OFFTOPIC] conditional compilation, WAS [RFC] Remove PHP 4 Constructors From: addw@phcomp.co.uk (Alain Williams) On Wed, Nov 19, 2014 at 07:17:48PM +0100, Julien Pauli wrote: > [Off Topic] > > It's been a long time I've been thinking about having a compile-time > preprocessor integrated into our parser/compiler stack. > I would design it just to support #migration tokens, and nothing more. > This would really ease migrations, with no runtime impact at all, and > the possibility to use any syntax, knowing it will get compiled, which > is not possible nowadays. > Like the C preprocessor. And it wouldn't be that hard to add to our > codebase, as there should not be any runtime impact, just a two-pass > parser > > Anyone interested can contact me :-) > > [/Off Topic] If you do, then please back port it to at least PHP 5.3 If you did then we would be able to write code with new syntaxes (that won't compile under 5.3/whatever) and automatically use them when the code is run under whatever version supports the syntax. Going back to the example that I gave & thinking a bit, a '$#' at the start of line (not recognised anywhere else) would work. It is an error under different circumstances and is sufficiently reminicent of C to be helpful of those of us with that background. $# if PHP_VERSION_ID > 50500 $# else $# endif Without wanting to make it too complicated, it might be nice to allow a 'set' (or 'define'), this would allow setting of flags, eg: $# if PHP_VERSION_ID > 50500 $# set FINALLY 1 $# endif $# if FINALLY ... $#endif -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include