{"id":19199655,"url":"https://github.com/arximboldi/heterarchy","last_synced_at":"2025-07-17T20:36:06.739Z","repository":{"id":32660314,"uuid":"36248036","full_name":"arximboldi/heterarchy","owner":"arximboldi","description":"Cooperative multiple inheritance for CoffeeScript, à-la Python. http://sinusoid.es/heterarchy/","archived":false,"fork":false,"pushed_at":"2017-04-10T09:04:51.000Z","size":311,"stargazers_count":12,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T20:12:05.010Z","etag":null,"topics":["c3","coffeescript","heterarchy","linearization","multiple-inheritance","python"],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arximboldi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-25T18:39:27.000Z","updated_at":"2018-07-30T10:29:18.000Z","dependencies_parsed_at":"2022-09-01T04:32:03.431Z","dependency_job_id":null,"html_url":"https://github.com/arximboldi/heterarchy","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arximboldi%2Fheterarchy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arximboldi%2Fheterarchy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arximboldi%2Fheterarchy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arximboldi%2Fheterarchy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arximboldi","download_url":"https://codeload.github.com/arximboldi/heterarchy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253172159,"owners_count":21865472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c3","coffeescript","heterarchy","linearization","multiple-inheritance","python"],"created_at":"2024-11-09T12:28:18.549Z","updated_at":"2025-05-09T01:23:08.781Z","avatar_url":"https://github.com/arximboldi.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"heterarchy\n==========\n\nCooperative multiple inheritance for CoffeeScript, à-la Python.\n\n\u003ca href=\"http://badge.fury.io/js/heterarchy\"\u003e\n    \u003cimg src=\"https://badge.fury.io/js/heterarchy.svg\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://travis-ci.org/arximboldi/heterarchy\"\u003e\n    \u003cimg src=\"https://travis-ci.org/arximboldi/heterarchy.svg\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://coveralls.io/r/arximboldi/heterarchy\"\u003e\n    \u003cimg src=\"https://coveralls.io/repos/arximboldi/heterarchy/badge.svg\"/\u003e\n\u003c/a\u003e\n\nAdds multiple inheritance support to CoffeeScript (and JavaScript).\nIt uses the C3 linearization algorithm as described in the [famous\nDylan paper](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.19.3910\u0026rep=rep1\u0026type=pdf).\n\nExample\n-------\n\nThe library handles multiple inheritance and chains calls to `super`\nin a linear order, solving the diamond problem and allowing for\n[cooperative methods](http://www.artima.com/weblogs/viewpost.jsp?thread=281127). For\nexample, the following class heterarchy:\n\n\u003cdiv style=\"text-align:center\"\u003e\n  \u003cimg src=\"https://cdn.rawgit.com/arximboldi/heterarchy/master/pic/diamond.svg\"/\u003e\n\u003c/div\u003e\n\nCan be implemented with the following code.\n\n```coffee\n{multi} = require 'heterarchy'\n\nclass A\n    method: -\u003e \"A\"\n\nclass B extends A\n    method: -\u003e \"B \u003e #{super}\"\n\nclass C extends A\n    method: -\u003e \"C \u003e #{super}\"\n\nclass D extends multi B, C\n    method: -\u003e \"D \u003e #{super}\"\n```\n\nCalling `method` on a `D` instance would return the string `D \u003e B \u003e C \u003e A`\nshowing the class linearization.\n\nDocumentation\n-------------\n\n### API\n\n* [heterarchy][heterarchy]\n  \u003cbr/\u003eGitHub: [heterarchy.litcoffee](https://github.com/arximboldi/heterarchy/blob/master/heterarchy.litcoffee)\n\n### Tests\n\n* [spec.heterarchy][spec.heterarchy]\n  \u003cbr/\u003eGitHub: [heterarchy.spec.coffee](https://github.com/arximboldi/heterarchy/blob/master/test/heterarchy.spec.coffee)\n\n  [heterarchy]: http://sinusoid.es/heterarchy/heterarchy.html\n  [spec.heterarchy]: http://sinusoid.es/heterarchy/test/heterarchy.spec.html\n\nInstallation\n------------\n\nThis is a standard [Node.JS](http://nodejs.org) module. One may\ninstall the library with:\n\n\u003e npm install heterarchy\n\n### Usage in the browser\n\nAfter cloning or downloading the repository\nyou can build all necessary files with\n\n\u003e make\n\nThis will create `heterarchy.js` in the `lib/` folder.  Including that\nfile in the browser will result in a global `heterarchy` variable that\ncontains the normally exported functions.\n\nSince the library requires `underscorejs` you must include it before\n`heterarchy`.  The functions that are used from `underscorejs` are (in\ncase you don't need the entire library):\n\n```\nhead, tail, map, find, some, without, isEmpty,\nevery, memoize, reject, isEqual, reduce\n```\n\n#### Example\n\n```html\n\u003cscript type=\"text/javascript\" src=\"path/to/underscore.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"path/to/browser.heterarchy.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\" src=\"my_app.coffee\"\u003e\u003c/script\u003e\n```\n\nwhere `my_app.coffee` could be\n\n```coffee\nclass A\n    method: -\u003e \"A\"\n\nclass B extends A\n    method: -\u003e \"B \u003e #{super}\"\n\nclass C extends A\n    method: -\u003e \"C \u003e #{super}\"\n\n# note the heterarchy namespace\nclass D extends heterarchy.multi B, C\n    method: -\u003e \"D \u003e #{super}\"\n```\n\nContributors\n------------\n\nThis library is maintained by [**Juanpe Bolivar**](http://sinusoid.es),\nwith the help of these outstanding contributors:\n\n- **Jim Neuedorf** [@jneuendorf](https://github.com/jneuendorf)\n\n  Added support for class methods, global exports in the browser and\n  fixed various issues.\n\nLicense\n-------\n\n*Heterarchy* is [Free Software][free-software] and is distributed\nunder the MIT license (see LICENSE).\n\n  [free-software]: http://www.gnu.org/philosophy/free-sw.html\n\n\u003e Copyright (c) 2013, 2015 Juan Pedro Bolivar Puente \u003craskolnikov@gnu.org\u003e\n\u003e\n\u003e Permission is hereby granted, free of charge, to any person obtaining a copy\n\u003e of this software and associated documentation files (the \"Software\"), to deal\n\u003e in the Software without restriction, including without limitation the rights\n\u003e to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n\u003e copies of the Software, and to permit persons to whom the Software is\n\u003e furnished to do so, subject to the following conditions:\n\u003e\n\u003e The above copyright notice and this permission notice shall be included in\n\u003e all copies or substantial portions of the Software.\n\u003e\n\u003e THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\u003e IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n\u003e FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n\u003e AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n\u003e LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n\u003e OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n\u003e THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farximboldi%2Fheterarchy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farximboldi%2Fheterarchy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farximboldi%2Fheterarchy/lists"}