问题描述
当我阅读完stackoverflow的答案和问题后,我得到的印象是,将OO划分为固有的功能.
As I have read through stackoverflow answers and questions I am getting the impression that OO is compartmentalized to to be inherently imperative.
但是OO不仅仅是将代码和数据划分为现实对象的一种方法吗?
But isn't OO just a way to compartmentalize code and data into real world Objects?
如果是这样,为什么要放弃其他较低级别的范例在这样的平台上工作?
If so, why would that forgo other lower level paradigm to work in such a platform?
IOW,一种默认情况下不变的基于对象的通用类型系统将是功能性第一语言的工作方式,默认情况下易变的基于对象的通用类型系统将是命令性语言的世界.
IOW, an Object Based generic type system that is immutable by default would be the way a functional first language would work, an object based generic type system that is mutable by default would be the world of imperative languages.
或者我完全错过了什么?
Or am I missing something altogether?
推荐答案
否. OO和命令式是两个正交的概念.
No. OO and imperative are two orthogonal concepts.
例如:
- Common Lisp对象系统是Lisp OO的一个示例,也许是周围最复杂的对象系统.
- OCaml是一种功能语言,具有对象系统和支持面向对象组织的模块系统
- Scala是具有非常灵活的OO系统的功能语言
- Haskell允许您使用种类更多的多态性来编写面向对象的代码
有很多不同的面向对象的方法.
There are lots of different ways to be object-oriented.
这篇关于使困惑. OO是天生必需的还是它是多范式的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!