4 ms·
Sure, any optimizing template engine would use Ruby's string interpolation, but it would still end up with this: _buffer << "<html> #{ form_for @stuff
by judofyr 16y ago
Sure, any optimizing template engine would use Ruby's string interpolation, but it would still end up with this:
_buffer << "<html>
#{ form_for @stuff do |f| }
#{ f.text_field :things }
#{ end }
</html>"
How are ERB going to figure out there's an opening of a block unless it actually parses the expression? ERB only sees this:
* "<html>"
* Output: form_for @stuff do |f|
* Output: f.text_field :things
* Block: end
* "</html>"
Just a plain list, not a tree.
- extension 16y agoIndeed, I'm hacking on it now and it seems like there is no way to avoid detecting complete vs incomplete expressions. I guess the question then becomes, can the expressions be classified in a way that is both fast and correct? Let's see if I can find a way.