mu-inheritance

mu(inheritance) : smal(lest?) inheritance javascript framework

µ(inheritance) allows :

  • inheritance between function (class)
  • multi-inheritance (but not recommended ;-))
  • to declare and use a constructor otherwise, you have an abstract class (unable to instantiate)
  • calling parent constructor (constructor name = function (class) name)
  • to test type of an object
  • using private variables without side effects with inheritance

This source code (<30 lines of code) is largely inspired by those books :

  • Javascript patterns - Stoyan Stefanov
  • JavaScript : the Good Parts - Douglas Crockford
  • Javascript cookbook - Shelley Powers
  • Pragmatic Guide to JavaScript - Christophe Porteneuve

I was guided by three rules :

  • module pattern
  • functional inheritance pattern
  • no prototype

and a "desire" : each class has a constructor (and be able to call her parent's constructor).

Explanation :

µ(inheritance) source code :


Warning: INSERT command denied to user 'kgkyojmt001'@'10.0.95.93' for table 'drp_watchdog' query: INSERT INTO drp_watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:376:\"INSERT command denied to user &#039;kgkyojmt001&#039;@&#039;10.0.95.93&#039; for table &#039;drp_accesslog&#039;\nquery: INSERT INTO drp_accesslog (title, path, url, hostname, uid, sid, timer, timestamp) values(&#039;mu-inheritance&#039;, &#039;taxonomy/term/124&#039;, &#039;&#039;, &#039;54.234.180.187&#039;, 0, &#039;9e827fa70788d82076f1caf4953d4f77&#039;, 362, 1369278420)\";s:5:\"%file\";s:60:\"/homez.312/kgkyojmt/www/modules/statistics/statistics.module\";s:5:\"%line\";i:64;}', 3,  in /homez.312/kgkyojmt/www/includes/database.mysql.inc on line 128

Warning: INSERT command denied to user 'kgkyojmt001'@'10.0.95.93' for table 'drp_watchdog' query: INSERT INTO drp_watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (0, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:906:\"UPDATE command denied to user &#039;kgkyojmt001&#039;@&#039;10.0.95.93&#039; for table &#039;drp_sessions&#039;\nquery: UPDATE drp_sessions SET uid = 0, cache = 0, hostname = &#039;54.234.180.187&#039;, session = &#039;messages|a:1:{s:5:\\&quot;error\\&quot;;a:1:{i:0;s:466:\\&quot;user warning: INSERT command denied to user &amp;#039;kgkyojmt001&amp;#039;@&amp;#039;10.0.95.93&amp;#039; for table &amp;#039;drp_accesslog&amp;#039;\\nquery: INSERT INTO drp_accesslog (title, path, url, hostname, uid, sid, timer, timestamp) v in /homez.312/kgkyojmt/www/includes/database.mysql.inc on line 128