Tuesday, August 28, 2012

C Is About Simplistic Memory Models

Ray Dillinger (via Manuel Simoni):

C is not just a simple language. Heck, it’s nowhere near as simple as, say, Scheme or Haskell. C is a simplistic model of the machine, memory, and runtime environment. It provides a few facilities for abstraction, but as a deliberate design choice, it makes sure that there are specific, simple, known ways for programmers to break every abstraction. That’s really what the ultra-simple memory model of C is all about; enabling programmers to break abstractions.

That isn’t a mistake or a design failure; That is exactly what the designers of the language set out to do. It is a goal in which they succeeded.

1 Comment RSS · Twitter

Huh, and I was under the impression that C abstractions were broken by default (e.g. buffer overruns 'r' us), and it's unbreaking them that requires the extra work. Which is also made excessively difficult and expensive by the lack of hygenic macros. Given that s-exprs as intermediate interchange format and the notion of building your platform from bottom-up to better suit the problem at hand were nailed a decade earlier by Lisp, C can hardly claim honest ignorance here.**

C is a true hacker language, with all the good and bad that entails, devised by hackers for hackers. It was designed by the most direct line to be 'good enough' to implement Unix, but no more. I actually love the idea of a simple, accessible language that puts you really close to the machine and permits you to bypass the safeties when you really need to. But in many respects C was a seriously under-exploited opportunity: a penny more invested at its time of origin would've saved many a pound since then, particularly in the areas of safe-fail behaviour and developer efficiency.

--

(** I've actually done language design myself, and the very first thing I did was nick every idea I could from every language around me. Does that make me insufficiently macho for C? Do I even care?:)

Leave a Comment