22 December 2014

Call Me Some Time

Thanks to r-bloggers, we get to read Dirk's rant on a Julia paean. Comments can't be made there, so here's mine.

While the post referenced by Dirk is bogus for the reasons Dirk decries, he's (purposely?) missing the point, one I've made once or twice along the way. To wit (and to woo): the R zealots continue to push R as both (not just one!!!) a Functional Language and an Object Oriented Language. Chambers demurs a bit in his book, but he's the exception. The OO bits are silly on the face, for anyone who's spent more than a semester's worth of time with an industrial strength OO language.

The Functional mantle is a bit murkier, and more deceitful, to my mind. Yes R has functions. So did/does Fortran, from which it sprang. So does every language on the planet, even 4GLs, although they tend to be called Procedures and the like. The point of the Julia post referenced is that R, native, bites the big weeny when asked to be recursive. The thing is, Functional Languages are all about recursion; they live by it. Be shitty at recursion, and you're shitty at Functional. It's that simple. There's a reason Rcpp (Dirk's baby, for those not up to speed) exists. But, just as Guido insists (last time I looked, anyway) that Python will never implement tail call optimization, so too, at the moment for R.

A Functional Language without explicit support for tail call will be fragile. Some structure will blow the stack or heap just when you least expect it.

So, yes, the post Dirk rants about is bogus, but that post's point is true: R isn't really a Functional Language if only because it misbehaves under recursion.

No comments: