基于原型的js语言
基于原型编程首先要考虑的问题:原型与对象的关系;
使用原型概念建立基于复用目的的联系链,以供运行时系统使用。
一、原型系统原理
封装、原型、多态 vs 封装、继承、多态
引用原型 vs 复制原型 机制
原型系统的复制操作,有两种实现思路,一个是并不真的去复制一个原型对象,而是使得新对象持有一个原型的引用,另一个是切实地复制对象,从此两个对象再无关联。历史上的基于原型语言因此产生了两个流派,显然,JavaScript 显然选择了前一种方式。
https://www.zhihu.com/question/54870785;
二、原型及原型链构建
三、运行时
Delegation[edit]
In prototype-based languages that use delegation, the language runtime is capable of dispatching the correct method or finding the right piece of data simply by following a series of delegation pointers (from object to its prototype) until a match is found. All that is required to establish this behavior-sharing between objects is the delegation pointer. Unlike the relationship between class and instance in class-based object-oriented languages, the relationship between the prototype and its offshoots does not require that the child object have a memory or structural similarity to the prototype beyond this link.
https://www.cnblogs.com/feng9exe/p/8289967.html
四、动态语言
http://www.cnblogs.com/Proteas/archive/2013/03/11/2953915.html
class based本身是对类型系统更友好的,而prototype based本身是需要动态类型或者弱类型的,因为“原型链”意味着一个对象的类型随时会改变,甚至一个对象的类型只能是这个对象本身。
最新文章
- HTTP状态码(HTTP Status Code)
- 简单爬虫,突破IP访问限制和复杂验证码,小总结
- iOS 使点击事件穿透透明的UIView
- linux常用指令
- JAVA动态加载JAR包执行程序
- 使用 SELinux 和 Smack 增强轻量级容器
- jQuery图片延迟加载插件jQuery.lazyload
- 网页热力图 heatmap js
- C++对象的JSON序列化与反序列化探索完结-列表的序列化与反序列化
- Python学习笔记之基本语法学习1
- bgp选路原则【第二部】
- 关于Ueditor存储在mysql";UTF-8";乱码的问题
- python爬虫之静态网页——全国空气质量指数(AQI)爬取
- css书写规范以及如何写出赏心悦目的代码
- MySQL索引优化步骤总结
- Anaconda安装新模块
- Map 数据结构
- MySQL调优基础, 与hikari数据库连接池配合
- 设计模式 -创建型模式 ,python工厂模式 抽象工厂模式(1)
- iOS 7.1 系统可以设置 button shapes,此功能可让按钮多一条下滑线