(评论)
(comments)

原始链接: https://news.ycombinator.com/item?id=44041515

Hacker News 正在讨论一篇论文《地窖里的Lisp:楼上住着的依赖类型》(The Lisp in the Cellar: Dependent types that live upstairs),这篇论文关注的是使用“Deputy”在 Clojure 中实现依赖类型。依赖类型允许类型依赖于值,这对像 Lisp 这样的语言来说是一个挑战,因为在 Lisp 中重新定义顶层值是很常见的。 讨论围绕着重新定义如何影响类型检查展开,尤其是在随后的定义依赖于较早的值时。可能的解决方案包括变量遮蔽或在重新定义时重新检查所有相关的项。一位评论者建议采用一种基于事务的方法,类似于 Smalltalk,其中更改被捆绑在一起并在应用之前进行类型检查。 讨论还涉及到 Lisp 与 AI 的历史渊源,强调了它在 DSL 开发、模式匹配和数学符号方面的优势。文中提到了欧洲 Lisp 研讨会以及过去使用 Lisp 的 AI 编程范式。


原文
Hacker News new | past | comments | ask | show | jobs | submit login
The Lisp in the Cellar: Dependent types that live upstairs [pdf] (zenodo.org)
86 points by todsacerdoti 1 day ago | hide | past | favorite | 19 comments










Sadly "deputy clojure" on Google brings no results...

The only hint is this repo[0] referenced in the paper.

[0]: https://gitlab.com/fredokun/deputy



Pretty readable code


Thinking out aloud here.

One pattern that I have frequently used in EMACS elisp is that redefining a top-level value overwrites that value rather than shadowing it. Basically hot reloading. This doesn't work in a dependently typed context as the type of subsequent definitions can depend on values of earlier definitions.

    def t := string
    def x: t := "asdf"
    redef t := int
redefining t here would cause x to fail to type check. So the only options are to either shadow the variable t, or have redefinitions type-check all terms whose types depend on the value being redefined.

Excluding the type-level debugging they mention, I think a lean style language-server is a better approach. Otherwise you are basically using an append-only ed to edit your environment rather than a vi.



I've fantasized about some kind of a dependently-typed Smalltalk-like thing before, and in those fantasies the solution would be that changes would be submitted in the form of transactions - they wouldn't be live until you bundled them all together into one big change that would be fully type-checked, as you describe.


The only option that you described is called "hyperstatic global environment".

And it is called that for a reason, it is not very dynamic :) and probably too static to the taste of many Lisp and all Smalltalk fans.



> EMACS elisp

I used this to write the front end for an ATM machine.



I don’t see the connection to dependent types. But anyway, is ‘redef’ part of your language? What type would you give it?


I just wrote redef to emphasize that I'm not shadowing the original definition.

    def a := 1
    def f x := a * x
    -- at this point f 1 evaluates to 1
    redef a := 2
    -- at this point f 1 evaluates to 2
But with dependent types, types can depend on prior values (in the previous example the type of x depends on the value t in the most direct way possible, as the type of x is t). If you redefine values, the subsequent definitions may not type-check anymore.


I see what you mean. But would you not experience the same sort of issue simply from redefining types in the same way? It seems this kind of destructive operation (whether on types or terms) is the issue. As someone who's used to ML, it seems strange to allow this kind of thing (instead of simply shadowing), but maybe it's a Lisp thing?


Impressive.


Related context: The 2025 European Lisp Symposium [1] was just wrapped a few hours ago in Zurich. There was content on:

- Static typing a la Haskell with Coalton in Common Lisp

- Dependent typing with Deputy in Clojure (this post)

- The Common Lisp compiler SBCL ported to the Nintendo Switch

- Common Lisp and AI/deep learning

- A special retrospective on Modula and Oberon

- Many lightning talks.

[1] https://european-lisp-symposium.org/2025/index.html



I feel like Lisp would be an ideal language for AI development. Its exceedingly good for DSL development and pattern matching. Its already structurally like math notation as well, which I would think would lend itself to thinking how models would consume information and learn


Well... believe it or not, some have thought of using lisp for AI for quite some time. ;-)


https://quantumzeitgeist.com/lisp-and-the-dawn-of-artificial...

Lisp was the de facto language of artificial intelligence in the U.S. for many years. Apparently Prolog was popular in Europe (according to Norvig's PAIP)



indeed.

Peter Norvig, 1992

Paradigms of AI Programming: Case Studies in Common Lisp

https://g.co/kgs/hck8wsE

https://en.m.wikipedia.org/wiki/Peter_Norvig

it's no coincidence Google is actively maintaining sbcl, either.



Why not go all the way to the source? John McCarthy coined the term "artificial intelligence", and then invented / discovered LISP in pursuit of it in the 1950s :D


Any URL for this that we can open in a browser (as opposed to the dreaded "Content-Disposition: attachment")?


https://zenodo.org/records/15424968 - This at least takes you to a webpage where you can view the paper. If you select to download it, it still downloads of course instead of just opening in the browser.


Thanks! I've switched to that above, and put the downloadable link in the top text.






Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



Search:
联系我们 contact @ memedata.com