It's important to provide context for why this project was created.
It's sponsored by Roam Research.
Roam Research has a complex web app (a note taking tool) written in Clojure.
They also wanted to build a mobile app for iOS and Android.
So instead of re-implementing everything from scratch in a new language they sponsored this project to compile Clojure to Dart.
That way they can re-use lots of code they've already written for web app and only write mobile front-end once in Flutter (but still in Clojure syntax) and create a mobile app.
This plan worked i.e. they do now have mobile apps for iOS and Android written this way.
I have no inside info so I don't know how much code they could reuse, how easy or not easy it was etc.
It's all based on publicly available information.
The point being: if you don't already have a large Clojure code base you want to reuse, then maybe doing just Dart + Flutter will be easier and faster.
I wonder why they didn’t simply opt to use ClojureScript with React Native. That seems like a much more pragmatic move than creating and supporting your own compiler to Dart just so you can use Flutter.
I am one of the co-author of ClojureDart. ClojureDart has been in the making for a year when we met the RoamResearch folks. They provided a definite boost and were bold enough to bet their mobile strategy on it. Its development was not commissioned by Roam though. It’s a project we wanted to work on for a long time and free time during Covid lockdowns helped.
This is very interesting to see, lots of fun use cases with Clojure + Flutter.
> no REPL yet
Seems the most vital part is missing so far, but impressive enough with this first version released. Something I personally I do when hacking on my own lisps (happens too often maybe), is implementing support for the nrepl protocol so I can use neovim + conjure with it as soon as possible, to help further the development of course :)
> When you edit your cljd file, the watcher recompiles cljd files and, on success, hot reloads the application. Sometimes the application may not pick up your change so hit the return key to get the watcher to restart the application.
Is this something specific to ClojureDart, is it because of Dart or because of Flutter? If it's because ClojureDart, it's alright as the project seems to be in early stages, but if it's because of Dart/Flutter it doesn't bode well. I have almost zero experience with either Dart/Flutter so interested to hear where the problem lies.
I haven't looked at ClojureDart, but Flutter/Dart certainly had excellent hot reload, usually maintaining state and so on. Perhaps it's just the immaturity of this project. I do remember the hot reload might not have worked like a file watcher? I vaguely remember I had to integrate a server call into vim or something on save, but it was a while ago.
ClojureDart co-author here. It happens in Dart too. Some changes are not compatible with the current application state. It may occur a bit more frequently because of Clojure being less stringent than dart about giving names to everything (which is tedious but definitely helps with hotreloading).
For those wondering how this is done, it involves: a new Clojure dialect and it's reader, core libs and a compiler.
The reader reads the specific tokens that define the Clojure Dart dialect via the data readers extension mechanism of the standard Clojure reader. Note, this dialect is not strictly compatible with other Clojure dialects, only with Clojure code that is host platform neutral 'pure Clojure', or code that uses dialect 'reader conditionals' to have specialised functionality. This is as it is with Clojurescript, and libraries made cljs friendly will not doubt be trivially made cljd friendly.
The core libs is where the bulk of the work lies, by lines of code at least. core.cljd is 7135 lines, with all the Java-isms (mainly IO, String and Math fns) replaced by Dart wrapper libs. A lot of it, however, is pure Clojure lifted straight from the original. Furthermore, there's a ready-made test suite.
Finally, the compiler. 4000 lines to produce Dart source from AST generated by the standard Clojure reader (but with Dart extensions support via tagged data).
Nice work! I'm actually pretty excited to give this a shot. I like Flutter and Clojure. But writing Dart isn't the most fun thing I can imagine doing. Fun is something I find important in personal projects, but not so much my day to day work. I don't care about the language that pays the bills, the type of projects is way more important there.
>But writing Dart isn't the most fun thing I can imagine doing
I really really do not understand this. Dart 2 is one of the most beautiful languages out there. Dart is a composition of the best parts of python (or maybe ruby?), javascript, c# and java.
Super excited to see this! Clojure is an absolutely delightful language to use professionally (not to mention insanely productive). I've heard great things about Flutter and Dart also from people I trust and admire.
I love LISP but this is too much to digest. Just because you can, you shouldn't do it. Flutter with Dart and component based architecture is still awesome.
What? Is Clojure too much to digest as well? Or ClojureScript? They are basically the same thing as this project, except they compile to JVM/JS code instead of Dart.
> Just because you can, you shouldn't do it.
Fuck that. If you can, have the time and have the resources, go for it! The world will be a better place if you do it and publish whatever comes out of it, success or failure.
kjksf|3 years ago
It's sponsored by Roam Research.
Roam Research has a complex web app (a note taking tool) written in Clojure.
They also wanted to build a mobile app for iOS and Android.
So instead of re-implementing everything from scratch in a new language they sponsored this project to compile Clojure to Dart.
That way they can re-use lots of code they've already written for web app and only write mobile front-end once in Flutter (but still in Clojure syntax) and create a mobile app.
This plan worked i.e. they do now have mobile apps for iOS and Android written this way.
I have no inside info so I don't know how much code they could reuse, how easy or not easy it was etc.
It's all based on publicly available information.
The point being: if you don't already have a large Clojure code base you want to reuse, then maybe doing just Dart + Flutter will be easier and faster.
brokencode|3 years ago
bdupuch|3 years ago
capableweb|3 years ago
> no REPL yet
Seems the most vital part is missing so far, but impressive enough with this first version released. Something I personally I do when hacking on my own lisps (happens too often maybe), is implementing support for the nrepl protocol so I can use neovim + conjure with it as soon as possible, to help further the development of course :)
From "https://github.com/Tensegritics/ClojureDart/blob/main/doc/fl..."
> When you edit your cljd file, the watcher recompiles cljd files and, on success, hot reloads the application. Sometimes the application may not pick up your change so hit the return key to get the watcher to restart the application.
Is this something specific to ClojureDart, is it because of Dart or because of Flutter? If it's because ClojureDart, it's alright as the project seems to be in early stages, but if it's because of Dart/Flutter it doesn't bode well. I have almost zero experience with either Dart/Flutter so interested to hear where the problem lies.
karma_fountain|3 years ago
cgrand-net|3 years ago
the-alchemist|3 years ago
Clojure is one of the few modern languages (someone please point out the others!) that you can use on top of any major platform:
* web, via Clojurescript
* mobile, via React Native
* JVM server-side, via reg' ol' Clojure
* .NET, via Clojure CLR
* microcontrollers, via https://ferret-lang.org/ (seems dead, tho)
and now Dart. Of course, being a hosted language has its own pros/cons, but it's truly impressive that a language has such comprehensive breadth.
You can literally share code between your Arduino project, REST backend, and HTML/CSS/JS frotend.
tosh|3 years ago
https://babashka.org
gavinray|3 years ago
https://kotlinlang.org/docs/multiplatform-dsl-reference.html...
coltnz|3 years ago
The reader reads the specific tokens that define the Clojure Dart dialect via the data readers extension mechanism of the standard Clojure reader. Note, this dialect is not strictly compatible with other Clojure dialects, only with Clojure code that is host platform neutral 'pure Clojure', or code that uses dialect 'reader conditionals' to have specialised functionality. This is as it is with Clojurescript, and libraries made cljs friendly will not doubt be trivially made cljd friendly.
The core libs is where the bulk of the work lies, by lines of code at least. core.cljd is 7135 lines, with all the Java-isms (mainly IO, String and Math fns) replaced by Dart wrapper libs. A lot of it, however, is pure Clojure lifted straight from the original. Furthermore, there's a ready-made test suite.
Finally, the compiler. 4000 lines to produce Dart source from AST generated by the standard Clojure reader (but with Dart extensions support via tagged data).
winkelwagen|3 years ago
macspoofing|3 years ago
I really really do not understand this. Dart 2 is one of the most beautiful languages out there. Dart is a composition of the best parts of python (or maybe ruby?), javascript, c# and java.
kylecazar|3 years ago
amackera|3 years ago
agilob|3 years ago
unknown|3 years ago
[deleted]
andriosr|3 years ago
edem|3 years ago
truth_seeker|3 years ago
I love LISP but this is too much to digest. Just because you can, you shouldn't do it. Flutter with Dart and component based architecture is still awesome.
capableweb|3 years ago
What? Is Clojure too much to digest as well? Or ClojureScript? They are basically the same thing as this project, except they compile to JVM/JS code instead of Dart.
> Just because you can, you shouldn't do it.
Fuck that. If you can, have the time and have the resources, go for it! The world will be a better place if you do it and publish whatever comes out of it, success or failure.