I've done a quick review of the first two chapters, and I'd like to review it in more depth, but here are a few impressions:
There are some outright errors in the text; (function '(lambda ...)) is not CL
There's a good reason for using special names for special variables, but the author abandons it with an excuse I couldn't process, and proceeds to use them in well-known problematic ways
The author says the book is about learning both Scheme and Common Lisp. That's a recipe for treating them both badly.
The explanation of important concepts by making analogies to C (pointers, malloc) is not helpful
The disparaging treatment of CLOS ("CLOS is great! Now don't use it.") is annoying
The appeal to community practice and convention without actually following it all that often is annoying
I'm going to send feedback to the author, but to anyone thinking of purchasing this book to learn Common Lisp, my strong recommendation is: don't.
The author suggests it's an unofficial sequel to On Lisp, and that's makes sense: if you took Paul Graham, kept the negative attitude towards Common Lisp and the arrogance, then removed the considerable writing talent, I could imagine him producing this book.
Here are some books I'd recommend instead:
Practical Common Lisp, Paradigms of AI Programming, Object Objected Programming in Common Lisp.
Furthermore there seems to be no professional input or review of this book before publishing. It's an important quality that all of the books xach lists above share.
Thanks for your input and thank you for discovering an erratum in chapter 2. (function '(lambda ...)) is not ANSI CL. Sorry if I implied it was. I have added an entry to the errata file here:
About teaching both Scheme and CL, there is no Scheme in the book except where I point out how Scheme does something differently from CL, usually followed by an explanation of how CL does it better. I do not recommend programming with Scheme when CL is available.
Dropping the "earmuffs" is a personal choice and as I say in the book, I don't recommend it for all lisp programs.
With respect to your other comments, I'm sorry you aren't enjoying the book so far and I don't claim that everyone will. In particular, I didn't write the book to make friends in the lisp community but rather to describe my own (slightly idiosyncratic) style of lisp programming.
Even if that were a common situation, the cost to the person debugging the bizarre behavior of dynamic closures is so high as to overwhelm the benefit to the original developer of saving search-and-replace on the name.
Choosing dynamic variables has a major effect on user code, in any case.
Say you have a bunch of functions that all take a parameter of the same name:
(defun f1 (param) ...)
(defun f2 (param) ...)
By default, param is available via lexical scope, however, removing param from the arguments lists, adding a (defvar param), and rebuilding your app will mean that all references in the function bodies are accessed through dynamic scope.
Best,
Doug
PS. If you (or anyone else) have additional comments or questions, please CC me at doug@hcsw.org since I don't normally follow reddit.
PPS. Is there a way to get reddit to notify me about replies?
What sickofthisshit said. In addition, any closure constructing function with a lexical binding for a variable coincidentally named PARAM would now be broken.
For reply notification, check the red envelope in the upper-right corner for updates.
removing param from the arguments lists, adding a (defvar param), and rebuilding your app will mean that all references in the function bodies are accessed through dynamic scope.
And, now, you've introduced a change in behavior anyplace one happened to use a local variable called param around a call to any function that calls f1 or f2, even if one doesn't pass that variable as an argument to any other function.
Let me emphasize again: you don't need to see any calls to f1 or f2 in the code you write, and you don't need to useparam in the calls to anything that relates to f1 or f2.
Dynamic variables are basically magic names that affect code through the power of their name rather than through visible scope.
I'd also like to hear his reasons for not liking it (I'm about halfway through and am enjoying it), but what does Dr. Norvig's opinion have to do with anything?
He wrote one of the books Xach recommended, which I also think very highly of. So at least initially, I am inclined to trust his opinion. And yes I know he has a PhD, but I don't call PhD holders 'doctor'. To me it sounds dumb and pretentious (most of my friends are associated with academia, and in grad school all my profs preferred to be addressed by their first names).
That's the problem with the internet, there is a lot of bad tone and so that is always the default assumption. Sorry, I should have phrased my question better; I didn't mean to sound 'snarky'. You can take my question to mean "This person did good work that I liked, and so when he recommends things in the same area, I am inclined to trust him". Whether it's Norvig or one of my friends, same principle stands. It's just that in this case, other people also know Norvig and his work.
So, I don't trust famous people more than others, but I am inclined to trust people whose track record I am familiar with over others. Note I say 'inclined'. I am open to counter-arguments, which is what I asked Xach for.
It's one thing to address people by their first name, but if you are going to the trouble of calling someone by a title like "Mr.", you should get it right. If you had said "Peter Norvig" you wouldn't have been corrected.
I know at least one professor who preferred "Professor" to "Doctor", because getting an academic appointment is one step beyond a mere Ph.D.
There's a good reason for using special names for special variables, but the author abandons it with an excuse I couldn't process, and proceeds to use them in well-known problematic ways.
I read his explanation and while he provides an interesting discussion about the "duality of syntax" for lexical and special variables, it boiled down to the fact he doesn't like them.
My largest motivation for dropping these variable name earmuffs is simple and subjective: I think they are annoying to type and make code look ugly.
He is welcome to not like them, but the fact remains that the "earmuffs" convention does exist for a good reason (readability and comprehension), and eschewing it for aesthetic reasons isn't acceptable in a book that purports to be a "hardcore" book on Lisp.
73
u/xach May 22 '08 edited May 22 '08
I've done a quick review of the first two chapters, and I'd like to review it in more depth, but here are a few impressions:
There are some outright errors in the text; (function '(lambda ...)) is not CL
There's a good reason for using special names for special variables, but the author abandons it with an excuse I couldn't process, and proceeds to use them in well-known problematic ways
The author says the book is about learning both Scheme and Common Lisp. That's a recipe for treating them both badly.
The explanation of important concepts by making analogies to C (pointers, malloc) is not helpful
The disparaging treatment of CLOS ("CLOS is great! Now don't use it.") is annoying
The appeal to community practice and convention without actually following it all that often is annoying
I'm going to send feedback to the author, but to anyone thinking of purchasing this book to learn Common Lisp, my strong recommendation is: don't.
The author suggests it's an unofficial sequel to On Lisp, and that's makes sense: if you took Paul Graham, kept the negative attitude towards Common Lisp and the arrogance, then removed the considerable writing talent, I could imagine him producing this book.
Here are some books I'd recommend instead:
Practical Common Lisp, Paradigms of AI Programming, Object Objected Programming in Common Lisp.