In my eyes this change isn't necessary and if it is, not with this syntax.

First the syntax: PHP is not C, we do not have preprocessing
instructions using hash notation. Such a syntax seems unfamiliar in
PHP. Additionally # is already used for single line comments so
there's actually is no backwards compatability: Old code that
accidentally was of your proposed form would trigger a line marker,
potentially causing much confusion when debugging. If we really do
need such a feature it should follow PHP's declare syntax:

declare(line=17, file='hi');
// or
declare(line=5) {
   // ...
}

Now concerning your use cases: It is fairly easy to rewrite PHP
errors. One of the examples you give are Smarty templates. Twig
(another template engine), already does line number rewrites by
inserting `// line ...` comments into the template and extracting that
information using the tokenizer.
(https://github.com/fabpot/Twig/blob/master/lib/Twig/Error.php#L147)
It's not terribly complicated. And this is the most complex case,
where line number distribution is not just off-by-n, but really
requires line-hints in the source. For the PHPT tests a simple
addition of the number of lines before the actual test will suffice.
Even no tokenizer needed.

(Sorry, forgot to send to list)

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to