{"id":21766999,"url":"https://github.com/setzer22/mutant-types","last_synced_at":"2025-06-27T02:32:35.345Z","repository":{"id":84504457,"uuid":"236330154","full_name":"setzer22/mutant-types","owner":"setzer22","description":"A library for creating clojure mutable types for when you really need it!","archived":false,"fork":false,"pushed_at":"2020-01-26T15:18:39.000Z","size":2,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T05:30:29.660Z","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/setzer22.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":"2020-01-26T15:18:21.000Z","updated_at":"2023-03-08T14:21:56.000Z","dependencies_parsed_at":"2023-03-11T13:30:46.604Z","dependency_job_id":null,"html_url":"https://github.com/setzer22/mutant-types","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/setzer22/mutant-types","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setzer22%2Fmutant-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setzer22%2Fmutant-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setzer22%2Fmutant-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setzer22%2Fmutant-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/setzer22","download_url":"https://codeload.github.com/setzer22/mutant-types/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/setzer22%2Fmutant-types/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262177563,"owners_count":23270892,"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-11-26T13:21:21.937Z","updated_at":"2025-06-27T02:32:35.330Z","avatar_url":"https://github.com/setzer22.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mutant Types\n\nThis small clojure library allows you to define `Mutable`s, a kind of `deftype`\nwith all of its fields marked as `:unsynchronized-mutable` which allows setting\nvalues from outside and works like a regular map (i.e. Implements ILookup like\n`defrecord`).\n\nAs with regular `deftype`, type hints work, and primitive type hints internally\ncreate a Java class with primitive types. Similarly, other kinds of type hints\nare used by the compiler but will not be enforced at runtime (i.e. you can set a\nfield hinted as `^Integer` to the value `\"Hello\"`, but not if it's an `^int`).\n\nThe `defmutable` in this repo is inspired by the great\n[https://github.com/arcadia-unity/Arcadia](Arcadia) library.\n\n## Usage\n \n`Mutable`s follow the same structure as a deftype. Here's an example:\n\n```clojure\n(require '[mutant.core :as mut])\n\n(mut/defmutable MyType [^int a, ^String b])\n\n(let [m (-\u003eMyType 1 \"2\")]\n  (mut/mut! m :a 25)\n  (mut/mut! m :b \"Hello\")\n  (println (:a m)) ; =\u003e 25\n  (println (:b m)) ; =\u003e \"Hello\"\n  \n  (mut/mut! m :a \"Hello\") ; =\u003e ClassCastException\n  (mut/mut! m :b 3)); =\u003e This works\n```\n\n## Note\n\nClojure doesn't have a macro like this for a good reason. Most of the time there\nis no need for the kind of `Mutable`s introduced by this project. This should\nonly be used in very tight loops of the codebase, and always as an\nimplementation detail, never as part of an API.\n\nPlease use with caution and only when really necessary. Also remember to\nalways measure first before optimizing!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetzer22%2Fmutant-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsetzer22%2Fmutant-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetzer22%2Fmutant-types/lists"}