2 ms·
I first ran into this issue several years ago, while I was using PERL (blargh). PERL has packages that allow you to put your HTML inside your code, or allow yo
by tjic 18y ago
I first ran into this issue several years ago, while I was using PERL (blargh).
PERL has packages that allow you to put your HTML inside your code, or allow you to put your code inside templates.
It soon became clear to me that neither is the win - the only real difference is "if I don't escape (via a quote character or a <? or a <%), what is a character considered - HTML or code?".
The problem is that code is there are two different conceptual trees - the HTML tree with nested elements, and the code tree with nested logic, and these trees do not have a 1:1 correspondence.
This is not a simple problem, and there are not simple answers.
Programming in Ruby and Rails for the last few years, I've become a fan of partials, but the tradeoff that you get is that for greater ability to read one file, you lose locality of reference ( http://en.wikipedia.org/wiki/Locality_of_reference http://en.wikipedia.org/wiki/Locality_of_reference ) - you might have a table row in one file, and the data data in another file entirely.
In general, I am a huge fan of straight text based editing, and always raise a dubious eyebrow at proposals for graphical editors and strange new editing tools.
...but I seriously wonder if there's some solution off in the space of a different kind of editor that lets you switch back and forth between viewing the code tree and the presentation tree...