{"id":13463730,"url":"https://github.com/nativelibs4java/Scalaxy","last_synced_at":"2025-03-25T09:31:02.394Z","repository":{"id":137918251,"uuid":"3960084","full_name":"nativelibs4java/Scalaxy","owner":"nativelibs4java","description":"Compiler plugin goodies for Scala (continuation of non-OpenCL part of ScalaCL)","archived":false,"fork":false,"pushed_at":"2015-04-09T12:47:14.000Z","size":15067,"stargazers_count":219,"open_issues_count":12,"forks_count":6,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-23T13:02:48.445Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://code.google.com/p/scalaxy/","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/nativelibs4java.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":"2012-04-07T19:37:22.000Z","updated_at":"2024-05-14T16:37:57.000Z","dependencies_parsed_at":"2023-03-30T17:05:23.349Z","dependency_job_id":null,"html_url":"https://github.com/nativelibs4java/Scalaxy","commit_stats":null,"previous_names":["ochafik/scalaxy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nativelibs4java%2FScalaxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nativelibs4java%2FScalaxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nativelibs4java%2FScalaxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nativelibs4java%2FScalaxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nativelibs4java","download_url":"https://codeload.github.com/nativelibs4java/Scalaxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245435075,"owners_count":20614823,"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-07-31T14:00:27.550Z","updated_at":"2025-03-25T09:31:00.272Z","avatar_url":"https://github.com/nativelibs4java.png","language":"Scala","readme":"Collection of Scala Macro goodies ([BSD-licensed](./LICENSE))\r\n\r\n\r\n- *[Streams](https://github.com/nativelibs4java/scalaxy-streams)* (*MIGRATED TO ITS OWN REPO*) provide a macro and a compiler plugin that optimize streamed collection operations / for comprehensions by rewriting them to equivalent while loops (Scala 2.11.x):\r\n\r\n    ```scala\r\n    for (i \u003c- 0 to n;\r\n         ii = i * i;\r\n         j \u003c- i to n;\r\n         jj = j * j;\r\n         if (ii - jj) % 2 == 0;\r\n         k \u003c- (i + j) to n)\r\n      yield { (ii, jj, k) }\r\n    ```\r\n\r\n- *[Loops](https://github.com/nativelibs4java/Scalaxy/tree/master/Loops)* provide a macro that optimizes simple foreach loops on Ranges by rewriting them to equivalent while loops (Scala 2.10.x):\r\n\r\n    ```scala\r\n    import scalaxy.loops._\r\n    \r\n    for (i \u003c- 0 until 100000000 optimized) { ... }\r\n    ```\r\n    (special case of / superseeded by Streams below)\r\n\r\n- *[JSON](https://github.com/nativelibs4java/Scalaxy/tree/master/JSON)* ([ScalaDoc](http://ochafik.github.io/Scalaxy/JSON/latest/api/index.html)) provides macro-based `json` string interpolation with smart error reporting, compile-time renormalization, deconstruction and more.\r\n\r\n- *[Parano](https://github.com/nativelibs4java/scalaxy-parano)* (*MIGRATED TO ITS OWN REPO*) provides compile-time checks to avoid common naming mistakes (ambiguous or swapped case class field extractor names, ambiguous unnamed param names with same type...)\r\n\r\n- *[Privacy](https://github.com/nativelibs4java/Scalaxy/tree/master/Privacy)* changes the default member visibily from public to private (unless the `@public` annotation is used)\r\n\r\n- *[Beans](https://github.com/nativelibs4java/Scalaxy/tree/master/Beans)* ([ScalaDoc](http://ochafik.github.io/Scalaxy/Beans/latest/api/index.html)) are a nifty combination of Dynamics and macros that provide a type-safe eye-candy syntax to set fields of regular Java Beans in a Scala way (without any runtime dependency at all!):\r\n\r\n    ```scala\r\n    import scalaxy.beans._\r\n    \r\n    new MyBean().set(foo = 10, bar = 12)\r\n    ```\r\n\r\n- *[Fx](https://github.com/nativelibs4java/Scalaxy/tree/master/Fx)* ([ScalaDoc](http://ochafik.github.io/Scalaxy/Fx/latest/api/index.html)) contains an experimental JavaFX DSL (with no runtime dependency) that makes it easy to build objects and define event handlers:\r\n\r\n    ```scala\r\n    new Button().set(\r\n      text = bind {\r\n        s\"Hello, ${textField.getText}\"\r\n      },\r\n      onAction = {\r\n        println(\"Hello World!\")\r\n      }\r\n    )\r\n    ```\r\n\r\n- *[Reified](https://github.com/nativelibs4java/scalaxy-reified)*  (*MIGRATED TO ITS OWN REPO*) provides a powerful reified values mechanism that deals well with composition and captures of runtime values, allowing for complex ASTs to be generated during runtime for re-compilation or transformation purposes. It preserves the original value that was reified, allowing for flexible mixed usage of runtime value and compile-time AST.\r\n\r\n    ```scala\r\n    import scalaxy.reified._\r\n    \r\n    def comp(capture1: Int): ReifiedFunction1[Int, Int] = {\r\n      val capture2 = Seq(10, 20, 30)\r\n      val f = reified((x: Int) =\u003e capture1 + capture2(x))\r\n      val g = reified((x: Int) =\u003e x * x)\r\n      \r\n      g.compose(f)\r\n    }\r\n    \r\n    println(\"AST: \" + comp(10).expr.tree)\r\n    ```\r\n\r\n- Obsolete experiments (mostly because of quasiquotes):\r\n\r\n  - *[MacroExtensions](https://github.com/nativelibs4java/Scalaxy/tree/master/Obsolete/MacroExtensions)* provides an extremely simple (and *experimental*) syntax to define extensions methods as macros:\r\n\r\n      ```scala\r\n      @scalaxy.extension[Any] \r\n      def quoted(quote: String): String = \r\n        quote + self + quote\r\n        \r\n      @scalaxy.extension[Int] \r\n      def copiesOf[T : ClassTag](generator: =\u003e T): Array[T] = \r\n        Array.fill[T](self)(generator)\r\n    \r\n      ...\r\n      println(10.quoted(\"'\"))\r\n      // macro-expanded to `\"'\" + 10 + \"'\"`\r\n      \r\n      println(3 copiesOf new Entity)\r\n      // macro-expanded to `Array.fill(3)(new Entity)`\r\n      ```\r\n\r\n  - *[Compilets](https://github.com/nativelibs4java/Scalaxy/tree/master/Obsolete/Compilets)* provide an easy way to express AST rewrites, backed by a compiler plugin and an sbt plugin.\r\n\r\n  - *[Debug](https://github.com/nativelibs4java/Scalaxy/tree/master/Debug)* ([ScalaDoc](http://ochafik.github.io/Scalaxy/Debug/latest/api/index.html)) provides `assert`, `require` and `assume` macros that automatically add a useful message to the regular [Predef](http://www.scala-lang.org/api/current/index.html#scala.Predef$) calls.\r\n    Please prefer [Assertions and DiagrammedAssertions](http://doc.scalatest.org/2.2.0/index.html#org.scalatest.DiagrammedAssertions) from ScalaTest.\r\n\r\n# Discuss\r\n\r\nIf you have suggestions / questions:\r\n- [@ochafik on Twitter](http://twitter.com/ochafik)\r\n- [NativeLibs4Java mailing-list](groups.google.com/group/nativelibs4java)\r\n\r\nYou can also [file bugs and enhancement requests here](https://github.com/nativelibs4java/Scalaxy/issues/new).\r\n\r\nAny help (testing, patches, bug reports) will be greatly appreciated!\r\n\r\n# Hacking\r\n\r\n- Pushing the site with each sub-project's Scaladoc at [http://ochafik.github.io/Scalaxy/](http://ochafik.github.io/Scalaxy/):\r\n\r\n    ```\r\n    sbt clean\r\n    sbt \"project scalaxy-doc\" ghpages-push-site\r\n    ```\r\n  (you can preview the site with `sbt \"project scalaxy-doc\" preview-site`)\r\n\r\n- Publishing projects on Sonatype OSS Repository + advertise on ls.implicit.ly (assuming correct credentials in `~/.sbt/0.13/sonatype.sbt`):\r\n\r\n    ```\r\n    sbt \"+ assembly\" \"+ publish\"\r\n    sbt \"project scalaxy\" ls-write-version lsync\r\n    ```\r\n\r\n","funding_links":[],"categories":["Tooling"],"sub_categories":["Angular"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativelibs4java%2FScalaxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnativelibs4java%2FScalaxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnativelibs4java%2FScalaxy/lists"}