TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Google's Common Lisp style-guide

178 pointsby zaph0dover 12 years ago

12 comments

zzyganover 12 years ago
This must have come out of the ITA Software acquisition.... (Heading "Attention required" 'You must follow the ITA convention of using...') They were a big common lisp user apparently.<p>Google is normally very specific on the languages allowed for internal projects. A product/company acquisition with large assets written in common lisp would necessitate this becoming the "Google Common lisp style guide" rather than what it was most likely originally the "ITA Software" common lisp style guide. Speculation of course, but looks likely.
评论 #4639925 未加载
评论 #4639652 未加载
ScottBursonover 12 years ago
A very useful document that I mostly agree with.<p>One area of difference is in the conditionals. I never use WHEN or UNLESS for value; only for effect. And, I never write NIL as one of the values returned by IF; I always condense the expression to AND or OR. That is, I freely use AND and OR to return non-boolean values; this is a practice some deprecate, and indeed, I'm surprised not to find it explicitly mentioned here.<p>I do like to write certain kinds of iteration as tail-recursions, but I always use local functions (LABELS) when doing that; there's no implementation I use regularly that doesn't do tail-call optimization on local calls.
评论 #4639738 未加载
评论 #4640586 未加载
dribnetover 12 years ago
This further reinforces how Yegge's recent "software political axis" rant was wildly inconsistent. His characterization of Clojure was "highly conservative" based in part on the best practices avoiding macros when possible, unlike "liberal" languages including Common Lisp.<p>Meanwhile in his own company's coding style for Common Lisp states very similar best practices regarding macros -- they should be used "sparingly and carefully", "You must never use a macro where a function will do.", etc. The whole macros section basically reads as a list of well thought out reasons <i>against</i> using macros when writing code that other people will have to maintain.<p>Yegge: "I trust that if you know anything about Lisp, your blood is basically boiling at this point." Really? Well then maybe the google CL team doesn't know lisp or otherwise are looking for novel ways to escalate their collective blood pressure.
评论 #4641429 未加载
评论 #4639953 未加载
评论 #4640813 未加载
评论 #4643430 未加载
评论 #4640414 未加载
JabavuAdamsover 12 years ago
I've often thought that stylistic (as opposed to semantic) formatting rules should be enforced by pre/post commit scripts or nanny scripts.<p>This would be a huge pain with hard-to-parse languages like C++, but might work a lot better for C / ObjC / CL / Java.<p>Just put your braces wherever they make you feel special, and let the formatter sort it out.<p>Anyone do this?
评论 #4641062 未加载
评论 #4641044 未加载
评论 #4641027 未加载
评论 #4642247 未加载
评论 #4641180 未加载
评论 #4641326 未加载
brudgersover 12 years ago
<i>"Everybody's code should look the same. Ideally, there should be no way to look at lines of code and recognize it as "Fred's code" by its style."</i><p>This is how one endeavors for mediocrity within a creative pursuit. Crap gets polished to a bronze sheen.
评论 #4640609 未加载
评论 #4640718 未加载
评论 #4640624 未加载
thebigshaneover 12 years ago
Related: ITA Software's Carl de Marcken discussing their use of Common Lisp for Orbitz from 2001 with a 2002 update.<p><a href="http://paulgraham.com/carl.html" rel="nofollow">http://paulgraham.com/carl.html</a><p>Snippet:<p><pre><code> ITA Software is slowly replacing the industry's hardware and software with Common Lisp code running on Linux PCs, that uses relatively involved algorithms that show off our academic CS background.</code></pre>
评论 #4641453 未加载
Kototamaover 12 years ago
Is this due to the acquisition of ITA Software? I though Google was not in favor of Common Lisp.
batgaijinover 12 years ago
Congratulations, Robert Brown and François-René Rideau!
mck-over 12 years ago
I'm not sure I understand/agree the point about "iteration over recursion". One of my favorite aspects of Lisp is the recursive approach to writing functions. It's still possible to write recursive functions that don't rely on a specific compiler's optimization:<p>(defun sum (numbers) (labels ((helper (todo ans) (if (null todo) ans (helper (cdr todo) (+ ans (car todo)))))) (helper numbers 0)))<p>I hope that this is what the author meant with "iterative" approach, because it is recursive by most standards.
评论 #4639915 未加载
评论 #4641795 未加载
trhtrshover 12 years ago
Why is the content buried under a million collapsed arrows?<p>Should "grammar nazi" have a capitalized "N", or should the term be avoided in a Style Guide?
评论 #4640537 未加载
评论 #4639716 未加载
nnqover 12 years ago
...is there any place one can find a list of companies/projects using CL and specifically what they do with it? ..or of open source projects using CL? (or do people still treat it as "our secret sauce")
评论 #4640105 未加载
jasongayaover 12 years ago
good one