Hacker News new | ask | show | jobs
by bryanrasmussen 1164 days ago
I think R is elegant, what's inelegant in it (other than the code lots of non-programmers write with it)?
3 comments

Core language design? Definitely elegant in my opinion. F-expressions, clever "formula" syntax, everything is an array, great C/C++/Fortran interop.

Standard library? Absolute chaos. Some elegant subsets, but mostly a mess that you learn to live with.

It has 4 ways to do object orientation if IIRC, none of which are compatible.
S3, S4, R6, and reference classes. To be fair they are situational and not one size fits all. The stricter ones are mainly used in biostats where significant metadata makes more sense in OO. S3 is nice and easy, primarily just a list with dispatches. Everything else is less so.
The type system is so abhorrent, it makes me wonder if it's actually proper to call R a real programming language
"There are only two kinds of languages: the ones people complain about and the ones nobody uses."
This crappy quote is always used to justify bad design.
I'm sorry, did you mean

    [1] "There are only two kinds of languages: the ones people complain about and the ones nobody uses."
:^)
And from a different point of view, real programming languages have built-in vectorization and 1-based arrays ;)
what specifically is abhorrent about it?
The coercion always gets on my nerves, JavaScript gets a bad rep but R is pretty damn warty too; weird ass data types ('ordered factor', anyone) that just seem so very far away from design choices in other languages without being particularly ergonomic or aesthetically appealing
The data types make sense to statisticians. Ordered factors are great when you need to fit, say, an ordered logit regression model.
Which coercion specifically are you talking about? Could you give an example?

Weird data types: R had been designed for and by statisticians with their specific needs in mind, which indeed could look weird to regular people.