TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Google's Common Lisp style-guide

178 点作者 zaph0d超过 12 年前

12 条评论

zzygan超过 12 年前
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 未加载
ScottBurson超过 12 年前
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 未加载
dribnet超过 12 年前
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 未加载
JabavuAdams超过 12 年前
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 未加载
brudgers超过 12 年前
<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 未加载
thebigshane超过 12 年前
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 未加载
Kototama超过 12 年前
Is this due to the acquisition of ITA Software? I though Google was not in favor of Common Lisp.
batgaijin超过 12 年前
Congratulations, Robert Brown and François-René Rideau!
mck-超过 12 年前
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 未加载
trhtrsh超过 12 年前
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 未加载
nnq超过 12 年前
...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 未加载
jasongaya超过 12 年前
good one