Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] "Go Considered Harmful"



Curt J. Sampson writes:

 > (Where it's not similar is in the amount of work it takes to build a class;
 > `data Tree a = Leaf a | Node (Tree a) (Tree a)` in Haskell is giving you
 > whole bunch of constructors and deconstructors that you'd have to build "by
 > hand" in Python or Java, the deconstructors often repeatedly throughout
 > your code using that data structure.)

Yeah, but then you have to write Haskell code.  (Amitrollyet?)

 > But in Haskell I found that at least a significant minority, and
 > sometimes the majority, of my "programming" work on a particular
 > thing was in writing the type definitions, and the rest of the code
 > was almost trivial or an afterthought in comparision.

One of those famous programming theorist types said something along
the lines of "show me your algorithms and I remain mystified, but show
me your data structures and the algorithms write themselves."  I
wouldn't go that far but I'm not a genius coder.  I do agree with the
basic idea that if your structures aren't well-defined, consistently
implemented, and coherent with each other, your algorithms are going
to be crap.

I'm not sure I'd call Haskell's typing system "strong typing" or
"strict typing" though -- they seem like awfully weak statements about
what it does for you (if you choose to take advantage of it, of
course).  Extending typing to higher-order functions is a difference
of kind rather than of strength.

 >> The rule of thumb in Clojure is data structures over functions, and
 >> functions over macros.

 > Well, that sounds to me like the rule of any decent Lisp programmer, or any
 > functional language programmer for that matter. ISTR Paul Graham saying
 > something along the lines that he rarely had more than a handful of macros
 > even in a large program.

defun is a macro ....  (I'm not a big fan of Paul Graham.)

As for *writing* macros, my main use of macros in Emacs is abusing
macrolet to write defsubsts (there's no local version of defsubst).  I
haven't seen all that many macros that do more than take advantage of
deferred evaluation, except those that implement control structures,
and there are very few of them even in Emacs.  It's not clear to me
that function > macro really bites (except when code obscurity is the
goal, and you're not going to stop those folkers with a rule of arms,
let alone just a thumb).


Home | Main Index | Thread Index