logoalt Hacker News

quuxplusonetoday at 4:24 AM0 repliesview on HN

Experienced programmers can skip to the conclusion, which (after a brief misstep to say that "accessing memory on the stack is, like any other memory access, O(n), depending on how much memory you access") is basically that the defining characteristic of a systems language is that no built-in operation should take more than O(1).

I mean, sort of. Except that obviously there are operations, like sorting, which necessarily take more than O(1). Suppose we had a language exactly like C except that `sort` was a builtin instead of a library function: would that make it less of a good systems language? Or is there something about spelling the operation "sort" that makes it more acceptable?

Is the ultimate criterion just that everything should have "the right" cost for how it's spelled — or in other words, that operations' costs should be predictable by the systems programmer — or in other words, the language shouldn't behave too weirdly given how it looks — or in other words it should look mostly like C, and the parts that look like C should also behave like C? I think that's a pretty decent criterion, actually.