基於原型的js語言

基於原型編程首先要考慮的問題:原型與對象的關係;php

 

使用原型概念創建基於複用目的的聯繫鏈,以供運行時系統使用。html

 

1、原型系統原理編程

 

封裝、原型、多態 vs 封裝、繼承、多態ui

 

引用原型 vs 複製原型 機制this

 

原型系統的複製操做,有兩種實現思路,一個是並不真的去複製一個原型對象,而是使得新對象持有一個原型的引用,另外一個是切實地複製對象,今後兩個對象再無關聯。歷史上的基於原型語言所以產生了兩個流派,顯然,JavaScript 顯然選擇了前一種方式。spa

 

https://www.zhihu.com/question/54870785;prototype

 

2、原型及原型鏈構建htm

 

 

3、運行時對象

 

Delegation[edit]blog

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

 

4、動態語言

 

http://www.cnblogs.com/Proteas/archive/2013/03/11/2953915.html

 

class based自己是對類型系統更友好的,而prototype based自己是須要動態類型或者弱類型的,由於「原型鏈」意味着一個對象的類型隨時會改變,甚至一個對象的類型只能是這個對象自己。

相關文章
相關標籤/搜索