joshua655 / v8cgi

Automatically exported from code.google.com/p/v8cgi
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Support for Embedded Code Blocks #70

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I would like to suggest the support of delimited code blocks. These would be 
similar to PHP's "<?php /* Server-side code. */ ?>" functionality.

I've posted this suggestion, with examples, on the CommonJS Google Group also: 
http://groups.google.com/group/commonjs/browse_thread/thread/b3ca1692fa830072

Thank you,
pikpik

Original issue reported on code.google.com by pikpik.1...@gmail.com on 21 Jul 2010 at 3:58

GoogleCodeExporter commented 9 years ago
First, embedded code blocks generally lead to sloppy programming practices, 
such as interrupting conditions and similar.

Second, have you ever looked at the "template" module, shipped with v8cgi? I 
strongly believe that it contains much of the functionality you request.

Third, it might be best to wait what CommonJS says about this feature, as I 
need v8cgi to stay fully commonjs-compliant.

Original comment by ondrej.zara on 21 Jul 2010 at 4:51

GoogleCodeExporter commented 9 years ago
Hi,

First point: I'm not quite sure I understand about interrupting conditions 
(using break is bad?).

Second: Thanks, I didn't look earlier because I didn't think it was relevant 
(sorry). Compared to the embedded code blocks, it seems like a very clean 
process, but perhaps a bit much with the need for template files? Can it also 
be done completely inside the running script?

Third: I fully agree there. Thanks for your work!

Thank you,
pikpik

Original comment by pikpik.1...@gmail.com on 21 Jul 2010 at 5:49

GoogleCodeExporter commented 9 years ago
First point - I was talking about:

<?php if ($something) { ?>
...
<?php } else { ?>
...
<?php } ?>

this leads to completely unmaintainable code, as soon as you start using these 
paradigms for a project larger than tiny :)

Second point - no, you must use templates. One the other hand, ask any skilled 
PHP coder and he will surely acknowledge that using templates (in PHP, as well 
as in any other language) is generally a very good idea.

Original comment by ondrej.zara on 21 Jul 2010 at 5:55

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi,

First point: That makes sense.

Second point: That generally sounds reasonable. I suppose if file system 
latency or speed are issues, the developer will output content in a more manual 
way?

Thank you,
pikpik

Original comment by pikpik.1...@gmail.com on 21 Jul 2010 at 6:21

GoogleCodeExporter commented 9 years ago
From the performance point of view, there are numerous options. One can use 
memcached to fast access; people also often cache templates filled with data. 
Templates can be also preprocessed and cached in a form of a machine code; you 
might be interested in how Dokuwiki performs its caching.

Original comment by ondrej.zara on 21 Jul 2010 at 7:34

GoogleCodeExporter commented 9 years ago
Hi,

That sounds good! It's great to see well-reasoned opinions.

Thanks for the discussion!
pikpik

Original comment by pikpik.1...@gmail.com on 21 Jul 2010 at 7:42