{"id":16099047,"url":"https://github.com/hellerve/bach","last_synced_at":"2026-03-18T17:54:28.109Z","repository":{"id":79626153,"uuid":"65488644","full_name":"hellerve/bach","owner":"hellerve","description":"Classes for zepto","archived":false,"fork":false,"pushed_at":"2018-05-02T16:05:19.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T05:12:21.255Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/hellerve.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-11T17:31:56.000Z","updated_at":"2023-09-08T17:13:35.000Z","dependencies_parsed_at":"2023-03-12T08:50:03.660Z","dependency_job_id":null,"html_url":"https://github.com/hellerve/bach","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellerve%2Fbach","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellerve%2Fbach/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellerve%2Fbach/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellerve%2Fbach/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellerve","download_url":"https://codeload.github.com/hellerve/bach/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411193,"owners_count":20934650,"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":[],"created_at":"2024-10-09T18:25:34.132Z","updated_at":"2026-01-20T02:27:11.372Z","avatar_url":"https://github.com/hellerve.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# bach\n\nClasses for zepto\\*!\n\nThey're really minimal. But inheritance is supported!\n\n\\* sort of.\n\n## Installation\n\n```\nzeps install hellerve/bach\n```\n\n## Usage\n\nThere are two macros you can make use of, `class` and `inherits`.\n\nA class could look like so:\n\n```racket\n(load \"bach/bach\")\n\n(class Person\n  (properties\n    :name\n    (:age :default 0))\n\n  (functions\n    (-\u003estring (lambda (self) (++ (Person:get-name self) \", age \" (-\u003estring (Person:get-age self)))))))\n```\n\nThis will generate the following functions:\n\n```racket\n(define joe (Person :name \"Joe\" :age 24))\n(Person:get-name joe) ; =\u003e \"Joe\"\n(Person:get-age joe) ; =\u003e 24\n(Person:-\u003estring joe) ; =\u003e \"Joe, age 24\"\n(Person:-\u003estring (Person:set-name joe \"Tina\")) ; =\u003e \"Tina, age 24\"\n(Person:-\u003estring (Person:set-age joe 30)) ; =\u003e \"Joe, age 30\"\n(Person? joe) ; =\u003e true\n(Person:get-properties) ; =\u003e [:name, :age]\n```\n\nYou can also inherit methods (but not properties!) from other classes:\n\n```racket\n(class Employee\n  (properties\n    :name\n    (:age :default 0)\n    (:job :default \"Programming Grunt\"))\n\n  (functions\n    (-\u003estring-with-job (lambda (self) (++ (Employee:-\u003estring self) \" (\" (Employee:get-job self) \")\")))))\n\n(inherits Employee Person)\n\n(define my-grunt (Employee :name \"Alyssa\" :age 35))\n(Employee:-\u003estring-with-job my-grunt) ; =\u003e \"Alyssa, age 35 (Programming Grunt)\"\n```\n\nAnd that's about it. Check out [the examples](https://github.com/hellerve/bach/tree/master/examples)!\n\n## Advanced Information\n\n### Inheritance resolution\n\nThe inheritance is resolved on a \"first statement wins\" basis, which means that\nif `Duck` and `Bird` both implement a method called `fly` and `Ostrich` inherits\nfirst from `Duck`, then from `Bird`, the `fly` method as implemented in `Duck` will\nbe used, whether it was inherited or not.\n\n### Typing Information\n\nUnder the hood, all the classes are hashmaps. No fancy magic involved. They do not\ncarry their functions around, so they're not classes, but rather prototype-ish.\n\n## FAQ\n\n**Q: Is this a serious project?**\n\n**A:** Not really, no. I have none of those.\n\n**Q: Is this ready for production?**\n\n**A:** Is zepto? If you answer that with yes, then sure, go ahead and use this library.\nYMMV.\n\n**Q: Why bach?**\n\n**A:** Because (1) I like to listen to the music the family Bach composed and, (2) they\nare the epitome of *class*ical music. Geddit? As if programming did not have enough\nterrible puns yet.\n\n\u003chr/\u003e\n\nHave fun!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellerve%2Fbach","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellerve%2Fbach","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellerve%2Fbach/lists"}