Live data from Hacker News

Clojure Dart

github.com

31–40 of 43 posts

Re: Clojure Dart

#31
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).

Re: Clojure Dart

#32
Exciting!

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.

Re: Clojure Dart

#33

Nah ! 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.

> I love LISP but this is too much to digest 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…

Obviously, you have no experience with flutter SDK and development tools ? Do you ?

Re: Clojure Dart

#34
post #22
post #18

Earlier quoted context omitted.

React Native apps are slow if not engineered well. Naïve implementations of RN apps tend to scale really badly. FB is fixing this with their new architecture (Fabric Render and TurboModule) but the rollout and adoption is even slower than their apps. Flutter on the other hand performs reasonably well (generally speaking) even if you outsource the engineering to the lowest bidder in Eastern Europe or South Asia. Flutt…

> Flutter on the other hand performs reasonably well (generally speaking) even if you outsource the engineering to the lowest bidder in Eastern Europe or South Asia. 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…

Unfortunately I didn't find it enlightening. It's just another anecdote. More likely a confirmation bias.

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.

Re: Clojure Dart

#35

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.

Ruby? Sorry, I don't see the connection.

Re: Clojure Dart

#36

Exciting! 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…

Thanks to babashka also for command line tools and other use-cases (serverless?) where startup time matters:

https://babashka.org

Re: Clojure Dart

#37

Exciting! 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…

Kotlin can do this as well, with Jetpack Compose as the multiplatform UI SDK

https://kotlinlang.org/docs/multiplatform-dsl-reference.html...

Re: Clojure Dart

#38
post #14

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…

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.

ClojureScript maintainers are actively hostile to making runtime errors understandable even if you offer contributions to help. I wouldn’t go back to that ecosystem.

Re: Clojure Dart

#39
post #14

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…

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.

Re: Clojure Dart

#40
post #18

Earlier quoted context omitted.

React Native apps are slow if not engineered well. Naïve implementations of RN apps tend to scale really badly. FB is fixing this with their new architecture (Fabric Render and TurboModule) but the rollout and adoption is even slower than their apps. Flutter on the other hand performs reasonably well (generally speaking) even if you outsource the engineering to the lowest bidder in Eastern Europe or South Asia. Flutt…

I don’t understand all the marketing hype about Flutter’s good performance. I can often tell an app is written with Flutter just based on how slow it feels on my iPhone 13 Pro. I think the 120 Hz screen doesn’t help, but there are obvious stutters in even simple apps. 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 Goog…

On iOS there are issues with shader compilation that cause stuttering. A fix is being worked on for quite some time now.

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.

Post reply on HN