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.

Channels in Common Lisp

94 pointsby codr4lifeover 8 years ago

7 comments

oskarthover 8 years ago
Surprised that a thread about CSP in Lisp doesn&#x27;t mention Clojure&#x27;s core.async. CSP in Clojure is implemented as just another library and it&#x27;s rock solid. While I don&#x27;t claim to understand the implementation in detail, it&#x27;s one of the more interesting and high leverage uses of macros I&#x27;ve seen in Clojure. It makes concurrent programming a breeze in Clojurescript as well, despite JS being single-threaded.<p>As someone who programs in both Clojure and Go there&#x27;s absolutely nothing I miss from CSP in Go, and I would much rather do concurrent programming in Clojure.<p>Rationale: <a href="http:&#x2F;&#x2F;clojure.com&#x2F;blog&#x2F;2013&#x2F;06&#x2F;28&#x2F;clojure-core-async-channels.html" rel="nofollow">http:&#x2F;&#x2F;clojure.com&#x2F;blog&#x2F;2013&#x2F;06&#x2F;28&#x2F;clojure-core-async-channe...</a><p>Code: <a href="https:&#x2F;&#x2F;github.com&#x2F;clojure&#x2F;core.async&#x2F;blob&#x2F;master&#x2F;examples&#x2F;walkthrough.clj" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;clojure&#x2F;core.async&#x2F;blob&#x2F;master&#x2F;examples&#x2F;w...</a><p>Presentations: <a href="https:&#x2F;&#x2F;github.com&#x2F;clojure&#x2F;core.async#presentations" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;clojure&#x2F;core.async#presentations</a>
评论 #13443231 未加载
评论 #13443080 未加载
评论 #13444914 未加载
haspokover 8 years ago
Sorry for the nitpicking, but:<p>&quot;One of the things that Go (and Erlang) got right was using channels as the main mechanism for synchronising and communicating between threads.&quot;<p>Erlang doesn&#x27;t have threads and doesn&#x27;t use channels either.<p>Erlang has lightweight processes, which might map onto OS threads (but user code has no control over this).<p>Erlang uses async communication which is always non-blocking (of course, you can emulate sync communication, the gen_server:call behaviour in the OTP library does that, for example).<p>Otherwise, spot on! :)
评论 #13445271 未加载
wtbobover 8 years ago
This illustrates the power &amp; the problem of Common Lisp: the power is that it really is easy to add channels (and pretty much every other feature) to the language yourself; the problem is that it&#x27;s generally easier to write your own code to do this than to use (or fix …) someone else&#x27;s.<p>I&#x27;ve experienced exactly this: I too looked at ChanL. In my case it had a bug for one of my use cases, and it was honestly easier to roll my own channels (with, of course, their own bugs) than to understand &amp; fix ChanL&#x27;s bug.<p>The problem is that this leads to a proliferation of different libraries, all doing similar things. The power is that one really can write just about anything, and it will work well enough for your use case.
评论 #13441873 未加载
评论 #13441837 未加载
评论 #13442013 未加载
评论 #13441949 未加载
评论 #13442356 未加载
评论 #13441874 未加载
lispmover 8 years ago
The book by Hoare on CSP <a href="http:&#x2F;&#x2F;www.usingcsp.com&#x2F;cspbook.pdf" rel="nofollow">http:&#x2F;&#x2F;www.usingcsp.com&#x2F;cspbook.pdf</a> published in 1985 actually used Lisp:<p>&gt; The proposed implementations are unusual in that they use a very simple purely functional subset of the well-known programming language LISP. This will afford additional excitement to those who have access to a LISP implementation on which to exercise and demonstrate their designs.
jsjolenover 8 years ago
I think a lot of people in this thread are being absolutely ridiculous. It&#x27;s not easy to implement channels in Lisp because of Lisp, it&#x27;s because the work is already done for you.<p>What mainstream language doesn&#x27;t have structs, condition variables, locks, threads and... Wait, I think that was all of it? Oh, and linked lists. I mean come on, you could do this just as easily in Java.<p>And all this talk of the Lisp curse, Jesus Christ. I mean, there&#x27;s a point in that there are a lot of lackluster libs (but what language doesn&#x27;t have that), but Quicklisp and a switch in Lisp culture means that there&#x27;s a large amount of collaboration (and usage of libs) between programmers. There&#x27;s the potential to start to use the same libraries and a will in the community to do so.
评论 #13454804 未加载
maxekmanover 8 years ago
Really interesting read for me as an experienced Go developer currently learning Lisp. Not sure if I will ever use Lisp or this for a real project, I see it more as some kind of Sudoku in code, and a indirect training ground for Elixir (which is a wonderful complement to Go for backend tasks).
评论 #13445191 未加载
评论 #13443689 未加载
farrayover 8 years ago
I once tried ChanL but it was buggy, and concurrency bugs are the worst to debug.<p>lparallel on the other hand was solid to me, though I didn&#x27;t like its API and had to (trivially) build my own message-passing abstractions on top of it.
评论 #13445988 未加载