Hacker News new | ask | show | jobs
by metaobject 3205 days ago
Or, the language designer thinking he's saving programmers work by jus returning the value in cases where there is a list of length one.

However, he's really making it worse because now all return values from that function have to be type-checked to see whether they are scalars or lists.

2 comments

R comes to mind, where once in a blue moon a matrix result will happen to only have a single column, which R helpfully decides should be turned into a simple vector, which then doesn't have the matrix operations available anymore (like dim()), and kaboom!
The classic story of every interpreted language.