Re: [SMARTY-DEV] nested comments
| From: | boots | Date: | Thu, 11 Dec 2003 22:03:00 +0000 |
| Subject: | Re: [SMARTY-DEV] nested comments | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1976@lists.php.net to get a copy of this message | ||
--- Monte Ohrt <monte@ispi.net> wrote:
> I can see where it would be nice to cleanly comment out a block of
> code you are working on. example:
>
> {**
> {* func1 doesn't work yet! *}
> {func1 foo=bar (??) }
> **}
>
> The difference between {** **} and a {if 0}{/if} is that the
> tokenizer > still parses things between the {if} statements, so you
> could possibly get broken stuff.
Well, that mostly shuts me up :) I have to admit the syntax choice is
clever since to the parser will happily strip those comments out in the
same way it strips {* *}--all that is needed is for the parser to
recognize them as distinct from {* *}.
Of course, I can imagine someone then suggesting {*** ***}. The logical
culminatation is someone suggesting {*..n *..n} where *..n is an
arbitrary number of asterisks. Probably not too hard to implement,
all-in-all, but it can lead to weird looking template code, if you ask
me.
It seems that the win-win situation is to get normal comments to nest
properly. :)
> That, and it is immediately recognizable that {** **} are comments.
> An {if 0}{/if} might be confusing to someone else reading your
> template.
This part I don't buy, since {if 0} is a very common technique in other
languages (like PHP) but mainly because this is exactly the type of
thing that shouldn't survive from developer to developer. There are few
things more confusing than inheriting code that has commented out
sections. What is the next developer to make of that?
I wonder if this should be done using a custom filter so people can use
any darn symbology they want to hide things from the compiler. After
all, this is comparable to pre-processor issues.
Anyone else?
xo boots
__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/