3 ms·
Yeah it's a moot point either way, because ERB is like that... but - This wasn't an optimization, it was literally the first thing I thought of when I wrote my
by chubot 6y ago
Yeah it's a moot point either way, because ERB is like that... but
- This wasn't an optimization, it was literally the first thing I thought of when I wrote my first and only template engine 10 years ago. And I have seen plenty of others do it; it is "obvious".
The code is the exact same length as the string version, so I don't consider it an optimization.
- Python's WSGI accepts an iterable of strings for the body. From a cursory reading, looks like Ruby's rack does too:
https://en.wikipedia.org/wiki/Rack_(web_server_interface)#Example_application https://en.wikipedia.org/wiki/Rack_(web_server_interface)#Ex...
e.g. it's ["Hello, World"] and not "Hello, World" (I don't know Ruby that well though)
Maybe frameworks mess it up in the middle...