├── LICENSE.md └── README.md /LICENSE.md: -------------------------------------------------------------------------------- 1 | **Eclipse Public License - v 1.0** 2 | 3 | THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE 4 | PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR 5 | DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS 6 | AGREEMENT. 7 | 8 | **1. DEFINITIONS** 9 | 10 | "Contribution" means: 11 | 12 | a) in the case of the initial Contributor, the initial 13 | code and documentation distributed under this Agreement, and 14 | 15 | b) in the case of each subsequent Contributor: 16 | 17 | i) changes to the Program, and 18 | 19 | ii) additions to the Program; 20 | 21 | where such changes and/or additions to the Program 22 | originate from and are distributed by that particular Contributor. A 23 | Contribution 'originates' from a Contributor if it was added to the 24 | Program by such Contributor itself or anyone acting on such 25 | Contributor's behalf. Contributions do not include additions to the 26 | Program which: (i) are separate modules of software distributed in 27 | conjunction with the Program under their own license agreement, and (ii) 28 | are not derivative works of the Program. 29 | 30 | "Contributor" means any person or entity that distributes 31 | the Program. 32 | 33 | "Licensed Patents" mean patent claims licensable by a 34 | Contributor which are necessarily infringed by the use or sale of its 35 | Contribution alone or when combined with the Program. 36 | 37 | "Program" means the Contributions distributed in accordance 38 | with this Agreement. 39 | 40 | "Recipient" means anyone who receives the Program under 41 | this Agreement, including all Contributors. 42 | 43 | **2. GRANT OF RIGHTS** 44 | 45 | a) Subject to the terms of this Agreement, each 46 | Contributor hereby grants Recipient a non-exclusive, worldwide, 47 | royalty-free copyright license to reproduce, prepare derivative works 48 | of, publicly display, publicly perform, distribute and sublicense the 49 | Contribution of such Contributor, if any, and such derivative works, in 50 | source code and object code form. 51 | 52 | b) Subject to the terms of this Agreement, each 53 | Contributor hereby grants Recipient a non-exclusive, worldwide, 54 | royalty-free patent license under Licensed Patents to make, use, sell, 55 | offer to sell, import and otherwise transfer the Contribution of such 56 | Contributor, if any, in source code and object code form. This patent 57 | license shall apply to the combination of the Contribution and the 58 | Program if, at the time the Contribution is added by the Contributor, 59 | such addition of the Contribution causes such combination to be covered 60 | by the Licensed Patents. The patent license shall not apply to any other 61 | combinations which include the Contribution. No hardware per se is 62 | licensed hereunder. 63 | 64 | c) Recipient understands that although each Contributor 65 | grants the licenses to its Contributions set forth herein, no assurances 66 | are provided by any Contributor that the Program does not infringe the 67 | patent or other intellectual property rights of any other entity. Each 68 | Contributor disclaims any liability to Recipient for claims brought by 69 | any other entity based on infringement of intellectual property rights 70 | or otherwise. As a condition to exercising the rights and licenses 71 | granted hereunder, each Recipient hereby assumes sole responsibility to 72 | secure any other intellectual property rights needed, if any. For 73 | example, if a third party patent license is required to allow Recipient 74 | to distribute the Program, it is Recipient's responsibility to acquire 75 | that license before distributing the Program. 76 | 77 | d) Each Contributor represents that to its knowledge it 78 | has sufficient copyright rights in its Contribution, if any, to grant 79 | the copyright license set forth in this Agreement. 80 | 81 | **3. REQUIREMENTS** 82 | 83 | A Contributor may choose to distribute the Program in object code 84 | form under its own license agreement, provided that: 85 | 86 | a) it complies with the terms and conditions of this 87 | Agreement; and 88 | 89 | b) its license agreement: 90 | 91 | i) effectively disclaims on behalf of all Contributors 92 | all warranties and conditions, express and implied, including warranties 93 | or conditions of title and non-infringement, and implied warranties or 94 | conditions of merchantability and fitness for a particular purpose; 95 | 96 | ii) effectively excludes on behalf of all Contributors 97 | all liability for damages, including direct, indirect, special, 98 | incidental and consequential damages, such as lost profits; 99 | 100 | iii) states that any provisions which differ from this 101 | Agreement are offered by that Contributor alone and not by any other 102 | party; and 103 | 104 | iv) states that source code for the Program is available 105 | from such Contributor, and informs licensees how to obtain it in a 106 | reasonable manner on or through a medium customarily used for software 107 | exchange. 108 | 109 | When the Program is made available in source code form: 110 | 111 | a) it must be made available under this Agreement; and 112 | 113 | b) a copy of this Agreement must be included with each 114 | copy of the Program. 115 | 116 | Contributors may not remove or alter any copyright notices contained 117 | within the Program. 118 | 119 | Each Contributor must identify itself as the originator of its 120 | Contribution, if any, in a manner that reasonably allows subsequent 121 | Recipients to identify the originator of the Contribution. 122 | 123 | **4. COMMERCIAL DISTRIBUTION** 124 | 125 | Commercial distributors of software may accept certain 126 | responsibilities with respect to end users, business partners and the 127 | like. While this license is intended to facilitate the commercial use of 128 | the Program, the Contributor who includes the Program in a commercial 129 | product offering should do so in a manner which does not create 130 | potential liability for other Contributors. Therefore, if a Contributor 131 | includes the Program in a commercial product offering, such Contributor 132 | ("Commercial Contributor") hereby agrees to defend and 133 | indemnify every other Contributor ("Indemnified Contributor") 134 | against any losses, damages and costs (collectively "Losses") 135 | arising from claims, lawsuits and other legal actions brought by a third 136 | party against the Indemnified Contributor to the extent caused by the 137 | acts or omissions of such Commercial Contributor in connection with its 138 | distribution of the Program in a commercial product offering. The 139 | obligations in this section do not apply to any claims or Losses 140 | relating to any actual or alleged intellectual property infringement. In 141 | order to qualify, an Indemnified Contributor must: a) promptly notify 142 | the Commercial Contributor in writing of such claim, and b) allow the 143 | Commercial Contributor to control, and cooperate with the Commercial 144 | Contributor in, the defense and any related settlement negotiations. The 145 | Indemnified Contributor may participate in any such claim at its own 146 | expense. 147 | 148 | For example, a Contributor might include the Program in a commercial 149 | product offering, Product X. That Contributor is then a Commercial 150 | Contributor. If that Commercial Contributor then makes performance 151 | claims, or offers warranties related to Product X, those performance 152 | claims and warranties are such Commercial Contributor's responsibility 153 | alone. Under this section, the Commercial Contributor would have to 154 | defend claims against the other Contributors related to those 155 | performance claims and warranties, and if a court requires any other 156 | Contributor to pay any damages as a result, the Commercial Contributor 157 | must pay those damages. 158 | 159 | **5. NO WARRANTY** 160 | 161 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS 162 | PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 163 | OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, 164 | ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY 165 | OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely 166 | responsible for determining the appropriateness of using and 167 | distributing the Program and assumes all risks associated with its 168 | exercise of rights under this Agreement , including but not limited to 169 | the risks and costs of program errors, compliance with applicable laws, 170 | damage to or loss of data, programs or equipment, and unavailability or 171 | interruption of operations. 172 | 173 | **6. DISCLAIMER OF LIABILITY** 174 | 175 | EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT 176 | NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, 177 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING 178 | WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF 179 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 180 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR 181 | DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED 182 | HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 183 | 184 | **7. GENERAL** 185 | 186 | If any provision of this Agreement is invalid or unenforceable under 187 | applicable law, it shall not affect the validity or enforceability of 188 | the remainder of the terms of this Agreement, and without further action 189 | by the parties hereto, such provision shall be reformed to the minimum 190 | extent necessary to make such provision valid and enforceable. 191 | 192 | If Recipient institutes patent litigation against any entity 193 | (including a cross-claim or counterclaim in a lawsuit) alleging that the 194 | Program itself (excluding combinations of the Program with other 195 | software or hardware) infringes such Recipient's patent(s), then such 196 | Recipient's rights granted under Section 2(b) shall terminate as of the 197 | date such litigation is filed. 198 | 199 | All Recipient's rights under this Agreement shall terminate if it 200 | fails to comply with any of the material terms or conditions of this 201 | Agreement and does not cure such failure in a reasonable period of time 202 | after becoming aware of such noncompliance. If all Recipient's rights 203 | under this Agreement terminate, Recipient agrees to cease use and 204 | distribution of the Program as soon as reasonably practicable. However, 205 | Recipient's obligations under this Agreement and any licenses granted by 206 | Recipient relating to the Program shall continue and survive. 207 | 208 | Everyone is permitted to copy and distribute copies of this 209 | Agreement, but in order to avoid inconsistency the Agreement is 210 | copyrighted and may only be modified in the following manner. The 211 | Agreement Steward reserves the right to publish new versions (including 212 | revisions) of this Agreement from time to time. No one other than the 213 | Agreement Steward has the right to modify this Agreement. The Eclipse 214 | Foundation is the initial Agreement Steward. The Eclipse Foundation may 215 | assign the responsibility to serve as the Agreement Steward to a 216 | suitable separate entity. Each new version of the Agreement will be 217 | given a distinguishing version number. The Program (including 218 | Contributions) may always be distributed subject to the version of the 219 | Agreement under which it was received. In addition, after a new version 220 | of the Agreement is published, Contributor may elect to distribute the 221 | Program (including its Contributions) under the new version. Except as 222 | expressly stated in Sections 2(a) and 2(b) above, Recipient receives no 223 | rights or licenses to the intellectual property of any Contributor under 224 | this Agreement, whether expressly, by implication, estoppel or 225 | otherwise. All rights in the Program not expressly granted under this 226 | Agreement are reserved. 227 | 228 | This Agreement is governed by the laws of the State of New York and 229 | the intellectual property laws of the United States of America. No party 230 | to this Agreement will bring a legal action under this Agreement more 231 | than one year after the cause of action arose. Each party waives its 232 | rights to a jury trial in any resulting litigation. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ClojureSwift 2 | ============ 3 | 4 | Clojure hosted on Apple's Swift language and [LLVM bitcode](http://en.wikipedia.org/wiki/LLVM). The main goal is to enable the creation of iOS and Mac OS X apps written in idiomatic Clojure. There should be good interoperability with Swift and Objective-C, and access to all the usual libraries and frameworks without hassle. The best approach might be to transpile to Swift and use Apple's tools. 5 | 6 | ### Literature Review 7 | 8 | ##### [jank](https://github.com/jank-lang/jank "Jank Clojure dialect") by [Jeaye Wilkerson](https://github.com/jeaye) 9 | Trying to cover all core language features and standard library. Targeting interface with 10 | C++ the way Clojure interfaces with Java. Still a [work in progress](https://jank-lang.org/progress/) (see detailed progress report) as of 2024-08-10 but looking very promising. 11 | Allows inline C++ code. *Mozilla Public License 2.0* 12 | 13 | ##### [Clojure-ObjC](https://github.com/galdolber/clojure-objc "ClojureObjc") by Gal Dolber 14 | Modified Clojure (JVM) compiler into a transpiler that produces Java code. Compile it to Objective-C LLVM bitcode using [Google's J2ObjC](https://github.com/google/j2objc "J2ObjC") with his own [lein-objcbuild](https://github.com/galdolber/lein-objcbuild "lein-objcbuild plugin") Leiningen plugin. Abandoned 2015-07-19. *Eclipse license* 15 | 16 | ##### [Goby](https://github.com/mfikes/goby "Goby ClojureScript on iOS") by Mike Fikes 17 | Develop iOS apps with ClojureScript. Goby targets the iOS JavaScript runtimes (JSExport, JavaScriptCore), allowing a REPL connected to an iOS device during development! Each iOS libary requires bridge code to be added, but eventually complex apps can be made. One app is already in the app store, and performance is good since native libraries can be called from JavaScript. See example app [Shrimp](https://github.com/mfikes/shrimp "Shrimp example Goby app"). Also see [Owen Mathews' blog post about JavaScript on iOS](""http://www.bignerdranch.com/blog/javascriptcore-and-ios-7/"). *Eclipse license* 18 | 19 | ##### [Cormorant](https://github.com/austinzheng/cormorant/ "Swift Lambdatron") (formerly "Swift Lambdatron") by Austin Zheng 20 | Currently a REPL capable of running a subset of Clojure. Still in very early phase, no docs yet. Design is very clean and easy to read. Inactive since 2015-07-01. *Eclipse license* 21 | 22 | ##### [ClojureC](https://github.com/schani/clojurec/ "ClojureC") by Mark Probst & 5 others 23 | Modified ClojureScript compiler into transpiler that produces C code, has examples for XCode/iOS and Android development. Uses Boehm Garbage Collector (which is available on HomeBrew as `bdw-gc`) and [Klib]("https://github.com/attractivechaos/klib"). Provides support for Leiningen builds and testing. Inactive 2018-04-25. *Eclipse license?* 24 | 25 | ##### [Tocatta](https://github.com/Toccata-Lang/toccata "Tocatta Clojure to Native Compiler") by Jim Duey 26 | Clojure subset, transpiles to C and targets the Clang compiler (which happens to be the default for Apple's XCode). It produces native binaries. It currently relies on the Boehm GC (see above). Still very early phase, no docs and poorly formatted C code. Very clever design. Active as of 2021-04-12. *Eclipse license* 27 | 28 | ##### [UIKit](https://github.com/galdolber/uikit "Clojure UIKit") by Gal Dolber 29 | Allows you to create iOS interfaces directly from Clojure code using Apple's AutoLayout system. It looks fairly mature (alpha vs. 5th commit for most of these projects), but perhaps somewhat limited in scope. *MIT + GPLv2 licenses* 30 | 31 | ##### [Jet](https://github.com/brettwooldridge/jet "jet Swift-to-JVM bytecode compiler") by Brett Wooldridge 32 | Compiler for Apple's Swift language that produces JVM bytecode targeting Java 8+. This might be useful info in handling interoperability well. *Apache 2.0 license* 33 | 34 | ##### [RoboVM](https://github.com/robovm/robovm "RoboVM Ahead of time JVM compiler") by RoboVM 35 | RoboVM translates Java bytecode into native ARM or x86 code. Several people have implemented iOS apps with Clojure on the platform. Simple access (syntactic sugar) for various APIs and frameworks. Performance is reported to be quite good, uses Boehm GC. *GPLv2 license except debugger* 36 | 37 | ##### [CL-LLVM](https://github.com/sellout/CL-LLVM "CL-LLVM") by Greg Pfeil 38 | Common Lisp compiler targeting LLVM bitcode. This might be leveraged to produce a Clojure compiler. Uses C FFI (foreign function interface) to LLVM. *MIT License* 39 | 40 | ##### [FFI-LLVM (Ruby)](https://github.com/postmodern/ffi-llvm "FFI LLVM") by Postmodern 41 | Ruby interfaces to the LLVM bitcode system. This provides a lot of example code for working with LLVM at a low level. *BSD? license* 42 | 43 | ##### [ClojureCLR](https://github.com/clojure/clojure-clr) + [Mono](http://xamarin.com/platform) by several people 44 | ClojureCLR could theoretically run on iOS with Mono. Several people have talked about it, but I can't find any evidence that it has been done, especially with open source examples. This might be viable for Clojure on iOS since Microsoft is contributing their CLR code to Mono, but interoperability with native code would undoubtedly be very poor. 45 | 46 | ##### [Clojure Google Group](https://groups.google.com/forum/#!searchin/clojure/swift/clojure/HaswRFJw29g/sH1xGpitmNgJ) by several participants 47 | Several people who are interested have contributed info, including the authors of several projects above. 48 | 49 | ### Details / FAQ 50 | Important questions 51 | 52 | * TCO (Tail Call Optimization) for recursion is supported by Swift. 53 | * Integers, Floating Point numbers, and other common types are already implemented by swift-lambdatron. 54 | * GC (Garbage Collection) is a problem. clojure-objc only has issues for interop bridged code. Will Swift's standard ARC (automatic reference counting) be enough? How can we implement GC cleanly? 55 | * How can we implement it so we're not duplicating everything? (e.g., core.async rewrite) 56 | * File extension: *.clsw perhaps, or use cljx 57 | * Copy [RoboVM's idea of YAML API]("https://github.com/robovm/robovm/tree/master/cocoatouch/src/main/bro-gen") with a Transit (JSON-compatible) description of Apple frameworks with automatic bridge code generation 58 | * [ReactiveCocoa + Swift]("http://www.scottlogic.com/blog/2014/07/24/mvvm-reactivecocoa-swift.html") would probably be a good idea. 59 | 60 | --------------------------------------------------------------------------------