top | item 1927463

(no title)

killbot5000 | 15 years 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.

discuss

order

extension|15 years ago

What makes you think the author is unfamiliar with this?

killbot5000|15 years ago

Since 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|15 years ago

Why 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 :)