On Arc

From Paul Graham's Arc release annoucement:

Over the years my appreciation for lists has increased. In exploratory programming, the fact that it's unclear what a list represents is an advantage, because you yourself are unclear about what type of program you're trying to write. The most important thing is not to constrain the evolution of your ideas. So the less you commit yourself in writing to what your data structures represent, the better.

Clearly Paul has been living in a cave for the past thirty-five years and did not hear about those quaint ideas, abstract data types and representation independence.

He seems to miss the obvious that using a list to represent a point is quite constraining because you are forced to require one coordinate be the first element of the list and the other coordinate be the second element of the list, and if you ever want to change it, good luck. I suppose his rebuttal would be »oh, it just takes too long or too many tokens to define an ADT for points«.

I really wonder how long it is going to take people to truly learn that telling the compiler about the structure of the data you work with is just as important as telling it about the control flow.

7 Comments »

  1. Matt Hellige said,

    January 30, 2008 @ 7:03 pm

    I’m afraid it will take even longer for people to learn that telling the compiler about the structure of your data is telling it about the control flow… (Yes, I admit I’m exaggerating for effect, but you know what I mean.)

  2. washburn said,

    January 30, 2008 @ 9:20 pm

    @Matt: I do not know that it should truly be considered an exaggeration. There are many operations that naturally defined inductively over a structure, and if the definition of the data type is well specified, the code pretty much writes itself.

    However, some would argue that this is a weakness of the approach because it leads to repetitive boilerplate code. This is where type-directed programming comes into the picture. You can’t very well eliminate the boilerplate by recursively walking over and ignoring everything in a data structure except the “points” if you can’t tell the difference between a point and any old two element list containing integers.

  3. Chris said,

    January 31, 2008 @ 12:19 am

    My position on types is of course well-documented, but I feel the need to play devil’s (Paul Graham’s?) advocate. He did qualify it with “in exploratory programming,” which to me means throwaway code, or mostly so. If you’re prototyping and “planning to throw one away” (Brooks), then quaint ideas like representation independence are indeed less of a concern. Also, in Paul’s camp, pro-types arguments carry little weight when they refer to fancy new features fresh out of POPL, like polytypic functions or rank-2 polymorphism. Whenever you need 10 dense POPL pages to justify some trick that Lisp hackers have been doing quite successfully since 1965, you lose. 😉

    That said, I have read a passage or two in Paul’s works (too lazy to find them now) that led me to believe he’s a bit misguided about modern type systems.

  4. Gavin Mendel-Gleason said,

    February 20, 2008 @ 6:02 pm

    The notion that most literate lisp hacker make use of to avoid difficulties is to use functions to abstract data-structures. Norvig makes extensive use of this strategy in “Paradigms of Artificial Intelligence Programming”.

    For instance with the point example:

    (defun make-p (x y) (cons x y))
    (defun x-coord (p) (car p))
    (defun y-coord (p) (cdr p))

    The functions then serve as the abstract interface. I think this is fairly close to the Co-Algebraic point of view, as we treat points as abstract objects coupled with operations on them, whereas Coq/Haskell/ML users would likely use a more Algebraic approach and structure things based on pattern matching. Of course the lisp approach is entirely ad-hoc and enforces no discipline. For disciplined Co-Algebraic stuff you might look at CafeOBJ.

  5. washburn said,

    February 27, 2008 @ 9:09 pm

    @Gavin: I know that there are ways to do abstract data types properly in Lisp. I just found Paul Graham’s dismissal of abstract data types naïve.

  6. Seth Tisue said,

    March 27, 2008 @ 4:45 pm

    “Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually need your flowcharts; they’ll be obvious.” — Fred Brooks, The Mythical Man-Month, 1975

  7. washburn said,

    March 27, 2008 @ 8:51 pm

    @Seth: Despite having read The Mythical Man-Month some years ago, I can’t say that I can recall enough about what he means by a “table” to tell what position he (or you) is advocating.

RSS feed for comments on this post · TrackBack URI

Leave a Comment