[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: succinctness = power
Paul Graham writes:
> Well, if the power of a language as a tool is reflected in something
> other than succinctness, tell us what. The reason I wrote that
> essay is to propose succinctness = power as kind of the first step
> in a newton's method-like approach to figure out what we should be
> aiming for in language design. To refine the estimate we need
> counterexamples, if there are any.
A few weeks ago on comp.lang.functional, someone posted the question,
"Besides syntax and dynamic vs. static typing, what are the main
differences between Scheme and SML?" I didn't answer the question,
mostly because when I tried I realized the answer was more subtle than
I expected. Both Scheme and ML make it easy for programmers to write
higher-order functions. However, the type of HOFs that Schemere and
ML'ers write are surprisingly different.
ML's static type system makes it very easy to write HOFs that are
folds over very complex datatypes, because the type system will give
early warning about most errors that result from passing the wrong
type function as an argument. You don't (or at least I don't) see
that many folds written in Scheme, because it's easy to get lost in a
twisty maze of function applications.
However, Scheme makes it very easy to write functions with recursive
type -- for example, to write a function that does one step of some
processing and then returns a new function that does the next step.
This is much less common in the ML I've seen because type recursion
has to go through a constructor [ex: type foo = Tag of (input -> foo)],
and the tagging/untagging hoops that you have to jump through to
satisfy the typechecker makes that style much less fun to use.
Newton's method wouldn't work in this case, because each language
makes a different style of code easier to write -- you've got multiple