Re: Re[6]: More accurate compiled file names

Antony Dovgal <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
On Mon, 31 May 2004 01:41:44 +0400
Dmitry Koteroff <[email protected]> wrote:

> AD> Yep,  but  we're  talking about Smarty templates and they are
> AD> much  more  easier,  than  PHP-code. Btw, Smarty already does
> AD> parse  them.  Anyway,  I'll try to write a patch myself. I'll
> AD> show you when it's ready.
> OK,  but are you agree that it's only another crutch (in addition
> to lots of others) and no more?

No, why?

> AD> This  is  not the case I'm talking about. PHP-code insertions
> AD> in templates are evil and you should be ready to pay for that
> AD> ({insert}  is  a special case and can be quite useful in some
> AD> situations).
> Why  should I pay for something if I can get the same on the next
> street corner? I don't understand.

Because Smarty is not intended for parsing PHP-code.
 
> I  agree  that  {php}  is a bad solution. But we really can do it
> more friendly for developer -
> 
> +                $_filename = $auto_source;
> +                $_filename = preg_replace("{[/\\\\]}s", "^", $_filename);
> +                $_filename = preg_replace("{[^a-z0-9~!_=.^-]}si", "_", $_filename);
> +                $_return .= $_filename;

Well, the most bad thing imho - it's to make developer to look into compiled templates.
That's what I'm talking about.
 
> (Maybe with concatenating crc32() result in addition, no matter).
> Why not? Can you motivate that?

Just because compiled template is generated by machine and for machine.
User/developer should look into it's code.
 
> >> What about {$spoon+1}, where $spoon is undefined? Smarty does not
> >> handle at all situations like this!
> AD> Just turn E_NOTICE off, in this case it doesn't matter, of course
> AD> if you know what you're doing.
> Oh, good advice - "just turn E_ERROR off and enjoy debugging hell
> forever  -  it is so masochistical!". It is NOT a solution, it is
> true  crutch.  I  love  E_ALL,  PHP  developers  -  too; it makes
> debugging process much easier.

Please, don't juggle with my words. I didn't say that. 
If you're so masochistical - you may continue to dig machine-generated code, thinking it's the best solution.
But I'm sure, THAT is the real crutch.
And I'm believe that E_NOTICE in templates it's not the same as E_NOTICE in the code.
Just think about it - your templates with lots of empty() & isset() will be really pain in the ass.

> AD> And  I'm  trying  to  say that Smarty just should prevent all
> AD> fatal errors like mismatched tags, using non-existent methods
> AD> and functions etc.
> It  is  impossible,  I  have  said  it before. How do you plan to
> handle such situation, for example?
> 
> {math equation="($a + spoon())*20"}

As I've already said, we CAN'T handle all situations, but we can TRY to handle most of them.
Btw, why you're changing examples all the time?
Started with mismatched tags and now you are talking about PHP-code.

> Do  you  want to write complete expression parser? Maybe you want
> to write PHP itself in PHP? (-;

No. That's funny, but I have already said that. Twice.

> Again:  my solution does not make our to pay something for it. It
> only  simplifies debugging in critical cases, no more, no less. I
> don't understand why don't you want to use it.

Because you're trying to make easier the process I don't want at all.
When your C program fails - are you digging the machine code or maybe starting up a debugger?
I'd choose a debugger and you're trying to make the machine code more readable.

---
WBR,
Antony Dovgal aka tony2001
[email protected] || [email protected]

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.