addicted to $
One of the weird historical accidents of programming languages is that
so many of them use $ for important things. The reason is just that
out of the available punctuation, nearly all of it has a mathmatical or
other predefined use that makes sense to retain in a programming
language context, while $ (and also @ and #) do not.
Still, $ annoys me, it's so asymetric that we use it all
over our code, and never a £ or ฿ to be seen.
The one language that manages to use $ nicely, IMHO, is Haskell.
Recently I noticed that it has an actual visual mnemonic in its use of $.
And it's used for something I've not seen in other languages.
The visual mnemonic of $ is that it looks like an opening
parenthesis, with the related closing parenthesis on a line below it.
(something (that
(lisp folks
(are (very (familiar with)))
)
))
And this is also the problem that $ solves:
something $ that $
haskell folks $
are $ very $ familiar with
This is a trivial feature.. but oh so useful.
The implementation in Haskell of $ is simply:
f $ x = f x
infixr 0 $
Just function application, but at a different precedence than usual.
I am now very addicted to my $. Out of 15 thousand lines of code,
only 87 contain )), while 10% use $.
