最“纯粹”的有哪些?面向对象语言?
最近对 Smalltalk 的介绍让我了解了“纯”面向对象风格的应用和好处。我之前在 Ruby 中看到过这样做的好处,尽管非面向对象的 if
、unless
等构造的存在似乎并没有一路承载一切通过。
在这里,我谈论的是“一切都是对象”(包括通过块或类似的东西的函数),并且没有过程式的流控制,而是在布尔值和流控制上使用流控制方法。收藏。
然而,即使在像 Smalltalk 这样的语言中,有些东西也因为不是面向对象而显得突出。例如,如果不使用特殊语法(:= 而不是“is:”或类似方法)似乎不可能进行变量赋值,并且从函数返回值似乎需要 ^ 运算符,而该运算符似乎不“属于” ' 对任何对象。
有没有什么语言可以进一步延续这种风格?
A recent introduction to Smalltalk has enlightened me on the application and benefits of a 'pure' object oriented style. I'd previously seen the benefits of this in Ruby, though the presence of non object oriented if
, unless
etc. constructs seemed like it didn't carry things all the way through.
By pure here, I'm talking about things like 'everything is an object' (including functions via blocks or something similar) and no procedural-style flow control, instead using flow control methods on booleans & collections.
Yet, even in a language like Smalltalk some things stand out as not being object oriented. For example it doesn't seem possible to do variable assignment without using special syntax (:= instead of an 'is:' or similar method) and returning values from a function seems to require the ^ operator which doesn't seem to 'belong' to any object.
Are there any languages that carry this style even further?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为一个长期使用 Smalltalker 的人,我(与这里的许多其他答案相比)理解你所追求的东西 - 并且“自我”语言确实走得更远,至少在作业方面。由于没有自行编程,我无法对此进行进一步评论。另一种与 self 类似的较新语言是 Slate,它也是典型的语言,也使用消息发送来进行分配。
As a long time Smalltalker I (compared to lots of other answers here) understand what you are after - and the "self" language does go a bit further, at least when it comes to assignments. Not having programmed in self I can't comment it further than that. Another newer language similar to self is Slate, also prototypical and also uses message sends for assignments.
Eiffel、Smalltalk 和 Ruby
http://www.jvoegele.com/software/langcomp.html
Eiffel, Smalltalk, and Ruby
http://www.jvoegele.com/software/langcomp.html