On Wed, 2006-08-02 at 17:14 -0500, Richard Lynch wrote:
> On Sat, July 15, 2006 9:47 pm, Robert Cummings wrote:
> > This has some really good implications for helping PHP users get the
> > line numbers more correct. For instance, from what I gather, my
> > template
> > engine can use this to dynamically generate PHP code from an XML tag
> > and
> > when the generated code fails due to some syntax error based on the
> > tag's attributes, If my engine included this directive then the engine
> > will tell them in what included template source file and on what line
> > they screwed up rather than them seeing an error that has no obvious
> > relationship whatsoever to what they did (did I get that right
> > Marcus?).
>
> So, what would the code look like that fixes this issue, from the
> sample posted?
>
> It seems to me like you're still going to get an error message about
> the right line number, but in the wrong file name.
>
> Or is #file also going in with #line, so your template engine can
> forge the filename for __FILE__ to the included file? I can see that
> working to solve this for you.
A file specification will also be part of the line directive. I believe
Marcus mentioned that in one of his posts.
> Working backwards from generated code to source files in templates is
> never fun, but solving this in PHP code instead of the template itself
> seems like a case of killing a fly with a cannon.
It can't be properly solved in PHP land without hacks that are still not
as useful as the line directive.
> It may make life a tiny bit easier for the experts, but I suspect
> #line is going to be abused by the naive to make life hell on the
> masses...
I don't think the naive will go near it. They would need someone to tell
them about it :) Of course, I'm sure it will happen, but that's why
documentation exists.
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'