Piers Cawley pdcawley at bofh.org.uk
Mon Dec 14 14:06:42 PST 2009

On Mon, Dec 14, 2009 at 8:32 PM, Tom Stuart <tom at experthuman.com> wrote:
> 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.

But the HTML document(s) are just as much of abstraction as the HAML document:


represents the same document as


the differences in the way its laid out are purely to do with human
readability and make no difference (modulo bugs) to the browser. The
differences between HAML and HTML are, admittedly, rather more
obvious, but, since there's a 1:1 bidirectional mapping, between them,
the only difference is, again, one of which one you find more

I prefer HAML - it makes the structure of the document more obvious to
my eyes, it has more information per unit of vertical space and it's
guaranteed to generate HTML that's easily parseable by human readers
when they're eyeballing the output. It also, by virtue of some of its
syntactic vinegar encourages me to put more of my boilerplate into
helpers. It looks like a win to me - one of these days I'll get round
to making it work in Perl as well, unless TT3 gets released while I'm

More information about the Chat mailing list