3 ms·
Persistent datastructures, STM, CAS concurrency primitives and hygenic macros make no sense outside of the JVM? Please... Clojure has host language interop, th
by Skinney 13y ago
Persistent datastructures, STM, CAS concurrency primitives and hygenic macros make no sense outside of the JVM? Please...
Clojure has host language interop, this isn't necessarily the same as Java interop. It would be very nice to write an iOS app using Clojure for instance.
- dmpk2k 13y agoI'd be delighted for a version of Clojure that both drops the JVM and can bind easily with C. One of Clojure's big advantages is that it uses the JVM. One of Clojure's big disadvantages is... that it uses the JVM.
- dschiptsov 13y agoAnother point is that one have to write a runtime, while Clojure "delegates" almost everything to JRE. Clojure is a very clever scripting language for JRE.) I think that it is good idea to marry Arc and Golang in the same way.)
- Skinney 13y agoNitpic: Clojure delegates most things to the VM. The subtle difference that it works just fine on JS engines and CLR. Arc and Golang would not be a good idea. I'm not trying to be overly negative, but Arc does have it's issues, the main thing being that Arc does not always work, meaning you would need some tool to hunt down leaks. RC is also slower than GC for several reasons, and when you require a runtime anyway for goroutines, you might as well include a GC, especially since Go can have a precise GC.
- javajosh 13y agoSo, just out of curiosity, how would you even begin planning such a task? Let's say you want to do something simple, like an analogue clock app that takes minimal user input (maybe a few look and feel settings). How would you structure that in Clojure in general, and Clojure-for-iOS in particular?
- Skinney 13y agoI would store application state in a atomic reference, and have "time" be updated every second by a timer. I would add a watch to the application state, so that every time application state changes, the UI is re-drawn. At least that's how I do most UI-apps in ClojureScript (re-draw auto magically when state changes). You'd do the same in Clojure-for-iOS. Of course, since you rely on Apples SDK for UI, you would use interop to subclass whatever needs subclassing, but the principle remains the same.
- dschiptsov 13y agoSomething I couldn't have in principle with Common Lisps? Plus predictable and controllable native code generation, efficient zero-copy FFI, come on.) And, you know, except for reader macros, Haskell..) Let's take it easy - I am familiar with the concepts Clojure is based upon.
- Skinney 13y agoYou could have that in principle in any language. In Clojure it's built-in and idiomatic. Besides, there are people who prefer Clojure over Common Lisp and Scheme. You asked why anyone would want Clojure without the JVM, I just told you there are many benefits, especially if your prefered language already is Clojure. Haskell really is something entirely diffrent than Clojure. Staticly typed, monads, template haskell. It's a nice language, but not as easy to use as Clojure IMHO.
- adwelly 13y agoThere are at least two alternatives to ClojureM; iOS7 runs js directly so ClojureScript can be used with a certain amount of fiddling. There is also a method of compiling Java into objective-c that is built into the Clojure Nightcode IDE. I ran some basic experiments over the holidays and both methods work, although there are inevitable trade offs.