From the accepted answer to "Why is Lisp useful?":
5. Wartiness. The real world is messy. Pragmatic coding winds up having to either use or invent messy constructs. Common Lisp has sufficient wartiness that it can get stuff done.
This thought has occurred to me, too. I'm currently developing an application whose backend I chose to write in Haskell, and whose frontend is in PHP. My experience has been that dealing with messy code in PHP is much easier than dealing with messy code in Haskell. However, it's my own code, and my PHP code probably isn't all that bad.
A simple example of "wartiness" is PHP's ==
(equality) operator. You know, the type of equality where '' == 0
is true. Since I'm wary of ==
, I often choose to use PHP's ===
(strict equality) operator instead:
$is_admin = ($gid === 24 || $gid === 25);
However, the above usage turned out to be wrong. The $gid
value came from the database, and is still a string. This time, the strict equality operator bit me, and I would have saved myself a few minutes by simply saying:
$is_admin = ($gid == 24 || $gid == 25);
Consider another interesting identity:
php> var_dump('0012345' == '12345');
bool(true)
What the heck?! ==
on two strings isn't even string comparison! However, consider if the user is given an ID card that says 0012345
, but the database ID is simply 12345
. Users may have trouble logging in to your application if you chose to use ===
. Sure, you'll get a bug report, and you'll be able to make your application correct rather than relying on this obscure feature. But it'll take more time. I'd rather spend that time outside. It's a really nice day.
By contrast, here's an example of wartiness that is not helpful in most cases:
js> parseInt(031);
25
What are some more concrete examples where "wartiness" helps you Get Things Done? Please explain why; don't just list features Haskell doesn't have.
Another way of putting it: what are some warty language features to be aware of, and how can we use them to save time?
parseInt(031) --> 25
is not "wartiness" - it is the format many (most?) programming languages (especially C inspired ones) use for octal literals.parseInt
- more sane programming languages are fine with this (eg C#)