[web-devel] Re: Hamlet & Haml

James Britt james at neurogami.com
Sat Apr 17 13:52:32 EDT 2010


John Bender wrote:
>   Notably in your rant you site static indentation and "most forms" of 
> static typing as "solving problems that don't come up in real life 
> code". Haskell would seem to be an interesting choice for your 
> development efforts in both cases then no? ;)

Oh, yes. :)

I think if Haml, Yaml, and other hard-line indentation formats used 
Haskell's off-side rule I'd find them easier to work with.

Haml, for example, demands a very specific indentation; off by one extra 
space and you get slapped, even if visually it is quite clear what is 
going on.  It makes for extra work for me.

The offside rule for Haskell also seems to make more sense in the 
context of function equations (e.g. this-side = that-side).

Having Haskell tell me "Think of this code as a set of equations" makes 
sense.  Haml's "Think of your essay document with embedded metadata as a 
rigid hierarchy of nodes" feels forced.

> 
> I think you make a fine point about xhtml being a great tool, but if you 
> plan to embed some form of syntax into your templates and avoid data 
> binding Haml is one of the better solutions out there.

Almost all of the Haml I've had to deal with is used in Rails projects, 
and data binding and embedded code is all over the place.  Sort of the 
worst of both worlds. :)  (And I find it harder to fix other people's 
code when it's in Haml.  Haml seems to favor writing over re-writing. 
But I'm ranting again.)

I don't mind mixing code in with templates, I'd much prefer I be given 
the choice as to when that is appropriate.   I just try to avoid it 
since it makes things harder in the long run.  But for knocking 
something out just to explore an idea it's great.

For example, I used to do JSP and ASP development, and I could write 
large chunks of code  inline the page markup to see if something was a 
useful path.  If so, I would then refactor the code out of the markup up 
and bundle it up in something faster/cleaner/easier to test.  But with 
everything in the page I could refresh the browser and see my results 
and avoid having to run the compiler, etc.

The risk, though, is that being undisciplined can lead to the 
stereotypical worst-case PHP kind of code.


James


More information about the web-devel mailing list