callSuper in kissy

521 views

Published on

implement super in KISSY

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
521
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

callSuper in kissy

  1. 1. callSuper in KISSY yiminghe@gmail.com 承玉
  2. 2. Super • Call super class method from sub class method with same signature.
  3. 3. Super in other language • Java • constructor default super() – keyword base() sub()
  4. 4. Super in other language • Java • Constructor Explicit call super – Must be on first line – keyword base(int i) sub()
  5. 5. Super in other languages • Java • Explicit call super.xx in overriden method – object sub run() base run()
  6. 6. Super in other languages • Python • Super – Build-in bind function( mro ) – Constructor is same with method • No first line constraint • Allow multiple inheritance Base init Sub init Sub run Base run
  7. 7. Super in other languages • JavaScript • But flexible
  8. 8. Super in KISSY • KISSY – Build own class system
  9. 9. Super in KISSY • callSuper • Built-in bind function (~python) • No need to specify method name • Does not allow multiple inheritance – Extensions(Mixins) + single Inheritance + plugin
  10. 10. Usage Base init M1 init Sub init Sub run Base run Sub destroy M1 destroy Base destroy
  11. 11. Bind usage • Closure?
  12. 12. internal • arguments.callee.caller • __owner__/__name__
  13. 13. refer • http://docs.python.org/3/tutorial/classes.htm l • http://www.python.org/download/releases/2. 3/mro/ • http://docs.oracle.com/javase/tutorial/java/Ia ndI/super.html • https://github.com/kissyteam/kissy/tree/mast er/src/base
  14. 14. Acknowledgements • goto100(义宇)

×