Clojure Dart
github.com
github.com
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.
Discussion on Flutter Performance at r/cpp is enlightening: https://www.reddit.com/r/cpp/comments/u0ut2a/comment/i4b0lqt...
> "Unfortunately, Flutter is currently a pile of hot garbage from the performance PoV.
> Their own Hello World example, which has one animated button on screen, which updates the label when you press it (see their screenshot) in Release manages to stutter on Moto G7 Power, a phone from 2019. Which smoothly runs quite demanding 3D games.
> According to Android Studio's profiler, about 20% of the frames do not fit into the time slot when the button is pressed. I don't know how did they manage to achieve this with such a trivial example on a Snapdragon 632, but they did it. So, to run smoothly on not-latest phones, your app should somehow be even simpler than their Hello World example, which seems hard to do.
I am not a smartphone dev. So I don't care either way. But I want to see a proper benchmarking. Not another internet hot take.
If a current generation flagship phone struggles, then I just can’t imagine how a more affordable phone that is a couple years old would fare.
See Google’s own Google Pay app as an example. Its performance is unforgivably bad. Perhaps it runs better on Android, but on iOS it feels bad.
The hype around performance is (I think) because it uses lower level rendering stack and a AOT compiler, but the comparision is being made mainly to JavaScript and web stack tech.
It could be fast as rendering speed depends mainly on how quickly can you rasterize and compose the graphic to the canvas. It uses Skia as the graphics backend, but Skia, while being very feature rich, is not the fastest. Dart is also not the fastest language around, but it has a lot of headroom for optimization. I'm also a bit skeptical about the performance impact of the immutable widgets tree, but maybe it doesn't have such a big performance impact as I imagine.
Overall, Flutter has potential to be quite fast. But currently, due to various issues, it's often not. I do love it though, due to how flexible is the rendering and due to the fact there is no markup language. It's really a joy to work with.
I think these statements are true for any application framework
> 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.
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.
https://kotlinlang.org/docs/multiplatform-dsl-reference.html...
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).
Flutter for web is at a weird stage right now. I think once AOM, WASM-GC and WebGPU are in place and well supported across browsers it will be a very different story but thats probably a year or two away at this point.
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.
But I'll bite. Most of the languages you've listed are C-like and all of them have mostly similar syntax and function although the ecosystems are very different. Have you ever experienced larger applications written in completely different class of languages? Languages like various lisps, Prolog, ML and so on.
Fair-enough ... Within the category of C-like language, Dart is quite nice.
>Have you ever experienced larger applications written in completely different class of languages?
I have not. I have played around with lisp (scheme), prolog, Haskell, ML ... But for various reasons never used them professionally.
If you look at libraries like built_value and built_collection and think that's beautiful when comparing it with Clojure than I'm sorry but you just don't know what you're talking about. Even the authors of these libraries (AFAIK from the Dart team) acknowledge the design decisions they had to make are a result of language limitations.
IMO it's literally the worst of Java and JavaScript - off the top of my head I've had several cases where I would get runtime exceptions about a type mismatch in a ternary expression that wasn't caught by type-checker, JS style. Type system was very weak in general. And the ammount of boilerplate and code generators I had to work with brought me back to Java 6 days.
TypeScript is miles ahead of Dart in terms of expressiveness and productivity, even when built on a pile of shit that is JS.
Flutter is an interesting project (the asynchronous IPC rendering architecture has some major drawbacks when interoperating with native components), but Dart is hands down the reason I wouldn't touch it in the future unless the team spends some serious effort on language ergonomics.
A decent implementation of Clojure + Flutter would change that equation for me considerably and Clojure would be a really good fit for Flutter.
As mentioned elsewhere in this thread it clearly DOES do well at exceptional scale given that the majority of Google’s revenue is all run through Dart. It’s also a really critical part of the new operating system they are currently spending stupid amounts of money building.
It’s funny that you mention TypeScript because for me every time I touch it I wish it was Dart for a million different reasons.
Not sure when the last time you used Dart but some of the things you mentioned gave me the impression it was either a while ago or you were doing some very specific stuff with it. I absolutely do not associate Dart with large amounts of boilerplate and especially not compared to a language like Java.
The package you mentioned built_value was just a clone of auto value in Java and similar to how the language made auto value no longer needed the same is happening in Dart this year as they are bringing in the concept of static metaprogramming to remove the limitations that lead to its initial existence.
I actually think of it as having the best language ergonomics of any C style language I’ve ever seen.
Guess we value different things…
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.
It's still unclear to me what actually is hard to digest here. Clojure? Dart? Flutter? ClojureDart?