42 ms·
The author seems to be unfamiliar with the "expression" and "statement" conventions used by imperative languages. An expression is something which has a value,
by killbot5000 16y ago
The author seems to be unfamiliar with the "expression" and "statement" conventions used by imperative languages. An expression is something which has a value, whereas a statement describes an action that doesn't (necessarily) have a result. <%= %> expects an expression ie something that has a value. <% %> expects a statement (or series of statements), which don't necessarily have a value.
- extension 16y agoWhat makes you think the author is unfamiliar with this?
- killbot5000 16y agoSince the author admittedly made up the term "complete expression" whose definition mirrors what I would expect for just "expression". He also used the word "subexpression" to describe parts of something that would otherwise be called a "statement". Though I think his vocabulary is a little confusing, after re-reading I think I get what he's actually complaining about. It is really awkward for a <%= %> tag to not actually be a self-contained, parse-able expression. On the other hand, you'd really rather have things like form_for return the text to print, not just print it (thus allowing the use of the <%= %> instead of <% %>). It's just one of those annoying situations where attempting to be pure and elegant results in an ugly kludge in the real world.
- sp4rki 16y agoWhy do you get that idea? I didn't get that impression at all. I don't think the author doesn't know the difference, I think he just used different terms to get his point across. I, thankfully, prefer to use Haml anyways :)