Saturday, November 06, 2010


I've heard that Perl is ugly because of all those pesky '$'. Purely esthetically this might be true, depending on the font used, but I have the impression that people use the word 'ugly' in a more metaphorical way, like 'ugly subroutine'. Somehow they believe that using an otherwise unused character for marking variables is inelegant - but I think they are confused, I think their opposition arises from the kneejerk reaction to an unfamiliar character. For me the '$' signs make parsing and understanding Perl code easier.

I've heard that TT2 code is ugly because it uses '[%' instead of the more familiar '<', and that it 'FOR' is a heavy burden for the eyes of the programmer because it is "shouting" at him, but I think that the features that make TT2 code standout in the text being templated make it easier to parse and understand and they help my eyes in their work.

Beside that purely ergonomical argument I don't see any purpose of the mini language and I think I am not that thrilled by the future direction of TT.


johnnapiorkowski said...

the sigils thing is surely a matter of taste. I personally find them useful although it is true with perl they are slightly less consistent then one might hope. I know this was a big early focus of Perl6, but not sure if everyone agrees that was successful. I think like a lot of perl programmers I tend to use refs a lot, so my code is scatter with '$'. I don't know if this is good or not.

The TT2 thing I think the biggest problem is for template authors that are more designers the big html editors don't have great hilighting support for the syntax and that is problematic. That I think is more a reflection on the priority (or lack of it) given to Perl by some of the companies that author these tools.

AFAIK you can use lowercase in TT2, there's a switch in there somewhere. Personally I've been moving away from TT style templating, although Xslate has some interesting features.

Anonymous said...

I think anyone of the mindset that are better than [tags] should be forced to work with HTML::Template for a project. They will see the error in their ways

xenoterracide said...

I don't my $ but -> is ugly... at least for object access... looking forward to Perl 6 . accessor... though I kind alike the . as a concatenation.

[% is just ... too much couldn't it have been just one character? case insensitivity in the names would be alright. Though my biggest complaint is how much finicking I have to do to get the [%- right.

Anonymous said...

I guess you know that you can change the tags in TT to be <% aned %> or anything else using the START_TAG and END_TAG options. Dancer defaults to that which tripped me as I was not expecting it.

Which is just what I think is the source of the "bla is ugly" comments of many people. "I am not used to it..." or "I did not expect it..." and so now "I hate it". Very human reaction.

Illusori said...

Mini-language template systems provide you with a layer of sandboxing from the application code, and provide a simpler learning curve than learning perl, and specifically which subset of perl you can use within the template.

You may not find that useful, many people however, rather like being able to allow their designers to perform basic tasks in the template, rather than having to pull a full-time developer of their current project to deal with it.

Anonymous said...

As Gabor said in TT it's just configurable.

My personal feeling first days about [% was a bit wtf ...

But as soon as you get familiar to it, it's excellent, like everything in TT in general.

The same for sigils... it's easy to blame sigils, verbose syntax, etc (it's easy to blame anything). But when you get used to, you loose them in other languages.

zby said...

Thanks for the comments. I think the main point here is that it is easy to have this 'what the fuck' feeling for trivial reasons, but it is not that easy to retract this. Human mind is very good in rationalizing.