Req #76036 [Opn->Sus]: Preprocessor directives

From: Date: Thu, 01 Mar 2018 09:13:36 +0000
Subject: Req #76036 [Opn->Sus]: Preprocessor directives
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214159@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76036&edit=1 ID: 76036 Updated by: requinix@php.net Reported by: obadja dot hauser at gmail dot com -Summary: Preporocessor directrives +Summary: Preprocessor directives -Status: Open +Status: Suspended Type: Feature/Change Request -Package: *Programming Data Structures +Package: Scripting Engine problem Operating System: ALL PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Thank you for your interest in PHP and for submitting a feature request. Please be aware that due to the magnitude of change this request requires, it would be necessary to discuss it on PHP Internals list (internals@lists.php.net) as an RFC. Please read the guide about creating RFCs here: <https://wiki.php.net/rfc/howto>. If you haven't had experience with writing RFCs before, it is advised to seek guidance on the Internals list (<http://php.net/mailing-lists.php>) and/or solicit help from one of the experienced developers. Please something something this comment something a view on the merits of your proposal – every proposal which requires changes of certain magnitude, even the very successful and widely supported ones, must be done through the RFC process. This helps make the process predictable, transparent and accessible to all developers. Previous Comments: ------------------------------------------------------------------------ [2018-03-01 08:44:18] obadja dot hauser at gmail dot com Description: ------------ In some cases can i need this feature. I think, this was a possible way to made code to running with modern features PHP >= 7 and on old Versions. Or to write fine granular code. Or transparence and clearer code. The preprocessor directives should recognized following: - #<preprocessor type> <preprocessor identifier> < - <preprocessor type>: #IF, #IFNOT followed by #ENDIF. Between ca #ELSE or/and #ELSEIF - <preprocessor identifier>: PHPVAR (PHP Version), OSVAR (OS Version), OS (OS Name), HTTPSRV (Webserver Name) and CLI (if true if running via cli command). It should possible to concatenate with AND. - <comparer>: <,<=,>,>=,= (= if the default comparer an is not needed to write it) - <compare value>: will always interpreted as string or number for the compare var Is there this feature planned or on your todo list :) Test script: --------------- My idea was so, e.g. class function: #IF PHPVER >= 8.0 public function getAndCatchMethod(string $methodname) : callable on throws \MyException #ELSE public function getAndCatchMethod(string $methodname) : callable #ENDIF { return [$this, $methodname]; } Expected result: ---------------- Code dynamical builded on preprocessor directives. #IF PHPVER >= 8.0 public function getMagic(string $value = '') : callable on throws \MyException { # this new killer feature will catching the Exception automatically to given Exception Class without to need try..catch, if method called ;) return [$this, $methodname]; } Class->getAndCatchMethod('test') MyException::catch() {} #ELSE public function getAndCatchMethod(string $methodname) : callable { # regular exception catching return [$this, $methodname]; } try { Class->getAndCatchMethod('test') } catch (...) { } Actual result: -------------- Nothing. This will not working at this time. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76036&edit=1

« previous php.bugs (#214159) next »