尝试学习:对象重定向和 LISP 中的通用函数!

发布于 2024-07-11 20:45:42 字数 319 浏览 9 评论 0原文

由于另一个问题,我正在阅读实用通用 Lisp。

我刚刚读了第 16 章和第 17 章,你可以在其中找到 LISP 如何管理对象。 但在思考 Java 如何管理对象几年后,我似乎无法真正理解如何使用 CLOS 在 LISP 中实现更大的体系结构。

因此,我要求你们花 20-50 页的时间阅读有关 CLOS 应用于更大架构而不是简单示例的内容。 也许是几篇博文,甚至是经验!

im reading Practical common Lisp as a result of another question.

I just read chapter 16 and 17 where you can find how LISP manages objects. But after a couple of years of thinking how Java manages objects, i cant really seem to understand how you would implement bigger architectures in LISP using the CLOS.

So i ask you guys for some 20-50 pages reading about CLOS applied to bigger architectures than simple examples. Maybe a couple of blogpost or even experiences!

TY

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

月亮邮递员 2024-07-18 20:45:42

如果您想获取这本书,Sonja E. Keene 所著的《COMMON LISP 中的面向对象编程》第 11 章(开发高级 CLOS 程序:流)包含一个涉及多重继承的重要示例,横跨约 40 页。

详细讨论了八个类(流、输入流、输出流、双向流、字符流、字节流、磁盘流和磁带流)。 然后,使用多重继承派生出用户期望创建其实例的具体类。

它比 Practical Common Lisp 中的银行帐户示例更丰富。 您可能还会发现 Keene 书中的其余部分有助于更深入地了解 CLOS:整本书都是关于 CLOS 的。

If you would like to get hold of the book, "Object-Oriented Programming in COMMON LISP" by Sonja E. Keene, Chapter 11 (Developing an Advanced CLOS Program: Streams) contains a non-trivial example with multiple inheritance spanning about 40 pages.

Eight classes are discussed in detail (stream, input-stream, output-stream, bidirectional-stream, character-stream, byte-stream, disk-stream and tape-stream). Concrete classes that a user would be expected to create instances of are then derived using multiple inheritance.

It's more substantial than the bank account example in Practical Common Lisp. You might also find the rest of Keene's book useful in gaining a deeper understanding of CLOS: the whole book is about CLOS.

薯片软お妹 2024-07-18 20:45:42

如果你真的想了解CLOS,你可以回去阅读元对象协议的艺术,为CLOS的子集版本Closette提供了基础和底层代码。

If you really want to understand CLOS, you can go back and read The Art of the Meta Object Protocol, which provides the basis and the underlying code for Closette, a subset version of CLOS.

蝶…霜飞 2024-07-18 20:45:42

也许可以看一下后面章节中介绍的示例应用程序。 您将看到类和对象只是您框中的另一个工具。 抵制使用 Lisp 语法进行 Java 编程的冲动。

另一个值得一看的地方是 Successful Lisp,第 7 章和第 14 章基础知识,第 31 章和 3.10 的一部分是关于打包和处理大型项目的。

一些 Lisp 大师(可能是 Paul Graham,但我不确定)曾经说过,他根本不需要 CLOS。

编辑:我认为您的困惑可能来自于这样一个事实:在 Lisp 中,您不使用类系统来组织命名空间。 这是单独完成的; 两者实际上没有任何关系。

Perhaps take a look at the example applications that are walked through in the later chapters. You will see that classes and objects are just another tool in your box. Resist the urge to program Java with Lisp syntax.

Another place to look at is Successful Lisp, chapters 7 and 14 for the basics, and chapters 31 and a part of 3.10 are about packages and handling large projects.

Some Lisp guru (it might have been Paul Graham, but I am not sure) once said that he has not needed CLOS at all yet.

edit: I think that your confusion may come from the fact that in Lisp, you do not use the class system for organizing namespaces. This is done separately; the two do not really have anything to do with each other.

浅唱ヾ落雨殇 2024-07-18 20:45:42

我们 Weblocks 也大量使用 CLOS,因此您可能需要稍微浏览一下源代码。

We at Weblocks also use the CLOS heavily, so you might want to browse the source a bit.

迷你仙 2024-07-18 20:45:42

更大的 CLOS 应用程序是
1) Lispworks 的 CAPI
2) cl-http 网络服务器
3)一个非常大的CLOS包是CLIM
4) 如果你喜欢 OpenGenera(这是一个使用 Common Lisp 和一些前身 ZetaLisp 的 Lisp 操作系统)
5) 较小的包是 http://www.cliki.net/mel-base

问候
弗里德里希

Bigger CLOS applications are
1) CAPI from Lispworks
2) cl-http webserver
3) a very large CLOS package is CLIM
4) if you like OpenGenera (that's a Lisp OS using Common Lisp and some predecessor ZetaLisp
5) a smaller package is http://www.cliki.net/mel-base

Regards
Friedrich

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文