Req #32734 [Opn->Sus]: Support for #line pragma, as in C and Perl
| From: | cmb@php.net | Date: | Wed, 27 Sep 2017 15:51:57 +0000 |
| Subject: | Req #32734 [Opn->Sus]: Support for #line pragma, as in C and Perl | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211399@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=32734&edit=1
ID: 32734
Updated by: cmb@php.net
Reported by: php at koterov dot ru
Summary: Support for #line pragma, as in C and Perl
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: all
PHP Version: 5.0.4
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 do not consider this comment as a negative 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:
------------------------------------------------------------------------
[2011-05-10 19:35:45] rasmus at mindplay dot dk
This feature is badly lacking to support many good, modern patterns, which could broaden the scope
and use of PHP in general. View-engines as mentioned, but not least aspect-oriented programming,
code generation and meta-programming in general, and cross-language-compilation from other
languages.
Microsoft's C# compiler has an implementation of this feature that could be referenced:
http://msdn.microsoft.com/en-us/library/aa691102%28v=VS.71%29.aspx
I would propose extending the existing syntax for execution directives, as implemented by the
declare keyword:
http://www.php.net/manual/en/control-structures.declare.php
It might looks like this:
// start of file
declare(source='test.c#20');
something();
declare(source='test.c#30') {
other();
more();
}
// end of file
Consistent with the way declare otherwise works - the first declare-statement in this example
changes the error-reporting for all of the following statements in that file, while the second
declare-statement changes the error reporting within the brackets.
I think this idea should be taken into serious consideration, as it has the potential to open up the
world of PHP to entirely new forms of development.
------------------------------------------------------------------------
[2005-04-17 08:47:01] php at koterov dot ru
Description:
------------
C, C++ and Perl support the folowing feature:
// start of file
#line 20 "test.c"
something
#line 30 "test.c"
other
// end of file
If error is generated into code "something", it is reported as error "in test.c on
line 20" - NOT on line 3! For code "other" - "in test.c on line 30". The
same Perl code example:
### start of file
#line 20 "test.c"
warn "something";
#line 30 "test.c"
warn "other";
### end of file
Result is:
something at test.c line 20.
other at test.c line 30.
Unfortunately PHP does not support this useful feature, and because of that any template engines
with pre-compilation (e.g. Smarty) make the life not so pleasant as it could be.
Do you plan to add #line feature in future versions of PHP? Programmers need it very much!
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=32734&edit=1