{"id":13801009,"url":"https://github.com/bodil/pylon","last_synced_at":"2025-08-20T02:04:36.273Z","repository":{"id":6161944,"uuid":"7391581","full_name":"bodil/pylon","owner":"bodil","description":"A Javascript class system in 100% Clojurescript","archived":false,"fork":false,"pushed_at":"2013-01-27T16:07:26.000Z","size":159,"stargazers_count":54,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-14T08:58:12.655Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bodil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-31T22:56:29.000Z","updated_at":"2025-04-03T15:32:25.000Z","dependencies_parsed_at":"2022-08-31T15:51:14.796Z","dependency_job_id":null,"html_url":"https://github.com/bodil/pylon","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bodil/pylon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodil%2Fpylon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodil%2Fpylon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodil%2Fpylon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodil%2Fpylon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bodil","download_url":"https://codeload.github.com/bodil/pylon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodil%2Fpylon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271172786,"owners_count":24711662,"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","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-04T00:01:18.536Z","updated_at":"2025-08-20T02:04:36.247Z","avatar_url":"https://github.com/bodil.png","language":"Clojure","funding_links":[],"categories":["Awesome ClojureScript"],"sub_categories":["JavaScript Interoperability"],"readme":"# \u003cimg align=\"right\" src=\"https://raw.github.com/bodil/pylon/master/pylon.gif\"\u003e Pylon\n\nA Javascript class system in 100% Clojurescript.\n\n## Rationale\n\nClass based OO is not cool. In fact, it's quite the opposite of the\nkind of code you should be writing as a Clojurescript developer.\nHowever, you sometimes find yourself having to deal with Javascript's\necosystem—certain of its more popular libraries in particular—out of\nnecessity. Clojurescript's core interop facilities are fine for\ndealing with dumb JS objects, but when you have to get into more\nadvanced OO—creating classes and subclasses—the primitives are no\nlonger adequate.\n\nPylon is intended as an interop facility. It is most emphatically not\nintended as a tool for turning Clojurescript into an OO language.\nDon't build your applications on it; be smart and use functional\nprogramming instead. Pylon is only for when you really need to deal\nwith legacy Javascript code.\n\n## Installation\n\nTo use Pylon in your project, put the following in the `:dependencies`\nvector of your `project.clj` file:\n\n```clojure\n[org.bodil/pylon \"0.3.0\"]\n```\n\n## Defining Classes\n\nUse the `defclass` macro to build Javascript style classes using Pylon.\n\n```clojure\n(ns pylon.test\n  (:require [pylon.classes])\n  (:use-macros [pylon.macros :only [defclass]]))\n\n(defclass Hello\n  (defn constructor [name]\n    (set! @.name name))\n  (defn hello []\n    (console/log (str \"Hello \" @.name \"!\"))))\n\n(.hello (Hello. \"Kitty\"))\n;; =\u003e \"Hello Kitty!\"\n```\n\nNote that all methods have a `this` symbol available to them, just\nlike in Javascript. Unlike in Javascript, it will always be bound to\nthe actual object instance, even when passing an instance method as a\ncallback.\n\nNotice the shorthand for referencing object properties: `@.name`\nanywhere inside a `defclass` is synonymous to `(.-name this)`. Thus,\nto read a property `foo` on the current object, simply use `@.foo`,\nand to set the property, use `(set! @.foo value)`. If `foo` is a\nmethod, you can invoke it directly using `(@.foo)`, or with arguments,\n`(@.foo \"bar\" \"gazonk\")`. (Note that this only works reliably on Pylon\nmethods, as Clojurescript will clobber `this` when a function is\ncalled in this way.)\n\n## Inheritance\n\nPylon allows you to define inheritance using the `:extends` keyword,\nand call superclass methods using the `super` macro.\n\n```clojure\n(ns pylon.test\n  (:require [pylon.classes])\n  (:use-macros [pylon.macros :only [defclass super]]))\n\n(defclass Hello\n  (defn constructor [name]\n    (set! @.name name))\n  (defn hello []\n    (console/log (str \"Hello \" @.name \"!\"))))\n\n(.hello (Hello. \"everypony\"))\n;; =\u003e \"Hello everypony!\"\n\n(defclass HelloSailor :extends Hello\n  (defn constructor []\n    (super \"sailor\")))\n\n(.hello (HelloSailor.))\n;; =\u003e \"Hello sailor!\"\n```\n\n## Mixins\n\nIf you need multiple inheritance, you can use the `:mixin` keyword to\nextend your prototype further. Note that we've left the world of\nprototypal inheritance behind when we do this: properties are copied\nfrom the mixin objects into your object prototype; it does not\nactually add more parent prototypes, which would be impossible.\n\n# License\n\nCopyright 2012 Bodil Stokke\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you\nmay not use this file except in compliance with the License. You may\nobtain a copy of the License at\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbodil%2Fpylon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbodil%2Fpylon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbodil%2Fpylon/lists"}