{"id":19502307,"url":"https://github.com/zio/izumi-reflect","last_synced_at":"2025-05-16T10:06:12.964Z","repository":{"id":37051475,"uuid":"241101768","full_name":"zio/izumi-reflect","owner":"zio","description":"TypeTag without scala-reflect. Supports Scala 2 and Scala 3.","archived":false,"fork":false,"pushed_at":"2025-05-07T19:03:12.000Z","size":1211,"stargazers_count":146,"open_issues_count":15,"forks_count":44,"subscribers_count":9,"default_branch":"develop","last_synced_at":"2025-05-13T09:01:50.354Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://zio.dev/izumi-reflect","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-17T12:25:42.000Z","updated_at":"2025-05-07T19:03:18.000Z","dependencies_parsed_at":"2024-11-08T18:30:43.227Z","dependency_job_id":"adffc9ab-bb84-4a70-abc5-f09412f8e0a8","html_url":"https://github.com/zio/izumi-reflect","commit_stats":{"total_commits":611,"total_committers":20,"mean_commits":30.55,"dds":0.7266775777414075,"last_synced_commit":"ce4423541a4372349fca0dabae8ad68e2236df57"},"previous_names":[],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fizumi-reflect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fizumi-reflect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fizumi-reflect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zio%2Fizumi-reflect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zio","download_url":"https://codeload.github.com/zio/izumi-reflect/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254509477,"owners_count":22082891,"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-10T22:16:02.360Z","updated_at":"2025-05-16T10:06:12.916Z","avatar_url":"https://github.com/zio.png","language":"Scala","funding_links":["https://www.buymeacoffee.com/7mind"],"categories":[],"sub_categories":[],"readme":"[![Project stage][Stage]][Stage-Page]\n[![Build](https://github.com/zio/izumi-reflect/workflows/Build/badge.svg)](https://github.com/zio/izumi-reflect/actions/workflows/build.yml)\n[![javadoc](https://javadoc.io/badge2/dev.zio/izumi-reflect_2.13/javadoc.svg)](https://javadoc.io/doc/dev.zio/izumi-reflect_2.13)\n[![Latest Release](https://img.shields.io/github/tag/zio/izumi-reflect.svg)](https://github.com/zio/izumi-reflect/releases)\n[![Maven Central](https://img.shields.io/maven-central/v/dev.zio/izumi-reflect_2.13.svg)](https://search.maven.org/search?q=g%3Adev.zio+a%3Aizumi-reflect)\n[![Latest version](https://index.scala-lang.org/zio/izumi-reflect/latest.svg?color=orange)](https://index.scala-lang.org/zio/izumi-reflect)\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.buymeacoffee.com/7mind\"\u003e\u003cimg src=\"https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png\" alt=\"Izumi\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003c!--- docs:start ---\u003e\n\n# izumi-reflect\n\n\u003e @quote: Looks a bit similar to TypeTag\n\n`izumi-reflect` is a fast, lightweight, portable and efficient alternative for `TypeTag` from `scala-reflect`.\n\n`izumi-reflect` is a lightweight model of Scala type system and provides a simulator of the important parts of the Scala typechecker.\n\n## Why `izumi-reflect`\n\n1. `izumi-reflect` compiles faster, runs a lot faster than `scala-reflect` and is fully immutable and [thread-safe](https://github.com/scala/bug/issues/10766),\n2. `izumi-reflect` supports Scala 2.11, 2.12, 2.13 and **Scala 3**,\n3. `izumi-reflect` supports Scala.js and Scala Native,\n4. `izumi-reflect` works well with [GraalVM Native Image](https://www.graalvm.org/reference-manual/native-image/),\n5. `izumi-reflect` allows you to obtain tags for unapplied type constructors (`F[_]`) and combine them at runtime.\n\n## Credits\n\n`izumi-reflect` has been created by [Septimal Mind](https://7mind.io) to power [Izumi Project](https://github.com/7mind/izumi),\nas a replacement for `TypeTag` in reaction to a lack of confirmed information about the future of `scala-reflect`/`TypeTag` in Scala 3 ([Motivation](https://blog.7mind.io/lightweight-reflection.html)), and donated to ZIO.\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://izumi.7mind.io/\"\u003e\n  \u003cimg width=\"40%\" src=\"https://github.com/7mind/izumi/blob/develop/doc/microsite/src/main/tut/media/izumi-logo-full-purple.png?raw=true\" alt=\"Izumi\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\n## Limitations\n\n`izumi-reflect` model of the Scala type system is not 100% precise, but \"good enough\" for the vast majority of the usecases.\n\nKnown limitations are:\n\n1. Recursive type bounds (F-bounded types) are not preserved and may produce false positives,\n2. Existential types, both written with wildcards and `forSome` may produce unexpected results, the support is limited,\n3. Path-Dependent Types are based on variable names and may cause unexpected results when variables with different names have the same type or vice-versa (vs. Scala compiler)\n4. This-Types such as `X.this.type` are ignored and identical to `X`\n5. `izumi-reflect` is less powerful than `scala-reflect`: it does not preserve fields and methods when it's not necessary for equality and subtype checks, it does not preserve code trees, internal compiler data structures, etc.\n6. There are some optimizations in place which reduce correctness, namely: subtype check for `scala.Matchable` will always return true, no distinction is made between `scala.Any` and `scala.AnyRef`,  no distinction is made between `scala.Nothing` and `scala.Null`. In other words, the library does not recognize that `Null` is not a subtype of `AnyVal`s.\n7. Lower bounds are not preserved in abstract higher-kinded type members which may produce false comparisons.\n8. Type and value members are not preserved in concrete types which may produce false comparisons with refined/structural types. (https://github.com/zio/izumi-reflect/issues/481)\n\n## Debugging\n\nSet [`-Dizumi.reflect.debug.macro.rtti=true`](https://javadoc.io/doc/dev.zio/izumi-reflect_2.13/latest/izumi/reflect/DebugProperties$.html#izumi.reflect.debug.macro.rtti:String(%22izumi.reflect.debug.macro.rtti%22)) to enable debug output during compilation when tags are constructed and at runtime when they are compared.\n\n```shell\nsbt -Dizumi.reflect.debug.macro.rtti=true\n```\n\nTo see debug output when compiling in Intellij, add the above flag to `VM options` in [Preferences -\u003e Build, Execution, Deployment -\u003e Compiler -\u003e Scala Compiler -\u003e Scala Compile Server](jetbrains://idea/settings?name=Build%2C+Execution%2C+Deployment--Compiler--Scala+Compiler--Scala+Compile+Server)\n\nYou may also set it in `.jvmopts` file during development. (`.jvmopts` properties will not apply to Intellij compile server, only to sbt)\n\nSet `-Dizumi.reflect.debug.macro.rtti.assertions=true` to enable additional assertions.\n\nOther useful system properties are:\n\n- [`izumi.reflect.rtti.optimized.equals`](https://javadoc.io/doc/dev.zio/izumi-reflect_2.13/latest/izumi/reflect/DebugProperties$.html#izumi.reflect.rtti.optimized.equals:String(%22izumi.reflect.rtti.optimized.equals%22))\n- [`izumi.reflect.rtti.cache.compile`](https://javadoc.io/doc/dev.zio/izumi-reflect_2.13/latest/izumi/reflect/DebugProperties$.html#izumi.reflect.rtti.cache.compile:String(%22izumi.reflect.rtti.cache.compile%22))\n\n\u003c!--- docs:end ---\u003e\n\n## Build\n\n`build.sbt` is generated by [sbtgen](https://github.com/7mind/sbtgen). During development you may not want to mess with ScalaJS and ScalaNative, you may generate a pure-JVM Scala project:\n\n```bash\n./sbtgen.sc\n```\n\nOnce you finished tinkering with the code you may want to generate full project and test it for all the platforms:\n\n```bash\n./sbtgen.sc --js --native\nsbt +test\n```\n\nTo develop using Scala 2 invoke sbtgen with a scala version argument:\n\n```bash\n./sbtgen.sc 2 // 2.13\n./sbtgen.sc 2.12 // 2.12\n```\n\nLikewise with Scala 3:\n\n```bash\n./sbtgen.sc 3\n```\n\nIn Intellij, you may also set Scala version by changing the option `sbt -\u003e sbt settings -\u003e Open cross-compiled projects Scala 3 / Scala 2 projects as:`\n\nProvided `flake.nix` can be used to set up the external dependencies necessary to build the project, such as sbt, JDK, coursier, etc:\n\n```bash\nnix develop\n```\n\n\u003c!--- docs:start ---\u003e\n\n# Talks\n\n* [Kit Langton — Scala 3 Macro Fun (Open Source Hackery)](https://www.youtube.com/watch?v=wsLhjqCKZuU)\n* [Pavel Shirshov — Izumi Reflect: Scala Type System Model](https://www.youtube.com/watch?v=ShRfzVz58OY)\n\n# See also\n\n## [`gzoller/scala-reflection`](https://github.com/gzoller/scala-reflection)\n\n* Scala 3 only\n* No support for subtype checks\n* Type lambdas are not supported\n* _Preserves field information_\n\n## [`airframe-surface`](https://wvlet.org/airframe/docs/airframe-surface)\n\n* Scala 2 and Scala 3\n* No support for subtype checks\n* _Preserves field information_\n\n## And even more\n\n1. https://github.com/gaeljw/typetrees - a very basic type tag substitute for Scala 3\n2. https://stackoverflow.com/questions/75752812/is-there-a-simple-scala-3-example-of-how-to-use-quoted-type-as-replacement-for - discussion on StackOverflow\n3. https://contributors.scala-lang.org/t/scala-3-and-reflection/3627 - original discussion on Scala Contributors forum\n\n[Stage]: https://img.shields.io/badge/Project%20Stage-Production%20Ready-brightgreen.svg\n[Stage-Page]: https://github.com/zio/zio/wiki/Project-Stages\n\n\u003c!--- docs:end ---\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzio%2Fizumi-reflect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzio%2Fizumi-reflect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzio%2Fizumi-reflect/lists"}