[LRUG] HAML
Tom Stuart
tom at experthuman.com
Mon Dec 14 12:32:19 PST 2009
On 14 Dec 2009, at 18:31, Piers Cawley wrote:
> On Mon, Dec 14, 2009 at 5:11 PM, Tom Armitage <tom at infovore.org> wrote:
>> I am always wary of abstractions
> The thing is, HAML is not an abstraction, not in the usual sense of
> the word at least. Given a valid html document it's possible to
> translate it directly to HAML and back with no loss of information.
Haml is an abstraction in a (perhaps less usual) sense: it partitions the space of all valid HTML documents into equivalence classes whose members differ only by boring details like whitespace and tag-balancedness, and for each such class it nominates a canonical member that has the nicest of these boring properties (e.g. whitespace properly indented, tags properly balanced).
Which is a precious way of saying that, in general, when you turn an HTML document into Haml and back again you actually end up with a subjectively better HTML document than the one you started with, because HTML -> Haml is a normalising process which throws away all the information you didn't care about in the first place, and I guess that's why people like it.
Cheers,
-Tom
More information about the Chat
mailing list