Any chance to run Clojure on Dart?

News on dart again:

2 Likes

I don’t know about Clojure, but I think ClojureScript -> Dart would be pretty interesting. For a while Dart didn’t appear to have the necessary hot reloading features, but this appears to have been resolved in the last couple of years.

3 Likes

It might become an important target, as Flutter is based on Dart, right?

2 Likes

Dart is no longer a VM, so we would need a transpiler now. The same way ClojureScript is a transpiler to JS.

Since it seems it now compiles itself to JS or to machine code directly. Is the Dart VM still used for anything?

I’m also wondering, might be someone else builds a JS to Dart transpiler before we come around building a CLJS to Dart one. That would be a long chain, but maybe it would work: CLJS -> JS -> Dart?

You need a transpiler for sure, but far as I know Dart VM is still a thing https://dart.dev

Oh right, seems they show that that’s what you’d use during development.

Anyone else gets the feeling that Flutter is just a modern version of Java Swing?

To my eyes, it looks pretty clear it’s inspired by React not Swing.

Found a related question on StackOverflow:

The React inspired interfaces and APIs is what I mean by “modern”, but I was talking more about the implementation strategy. If I quote wikipedia:

“Swing provides a look and feel that emulates the look and feel of several platforms, and also supports a pluggable look and feel that allows applications to have a look and feel unrelated to the underlying platform.” […] “Swing “paints” its controls using the Java 2D APIs, rather than calling a native user interface toolkit. Thus, a Swing component does not have a corresponding native OS GUI component, and is free to render itself in any way that is possible with the underlying graphics GUIs.”

As I understand, this is exactly what Flutter does. Only difference is Dart is used instead of Java, and Swing was a MVC framework in the style of popular UI toolkits of the time, while Flutter is a React like toolkit, of the style that is popular now.

So I’m finding it interesting how things come around. React Native was like Java AWT, and now Flutter is like Java Swing :yum: What’s up next… JavaFx?

1 Like

I think if you’re willing to put Swing, JavaFX, and QT in the same bucket (they all use their own UI rendering rather than native) then I think it’s valid to put Flutter in the same bucket.

There are pros and cons obviously. Going the Swing/FX/QT way avoids the mindless and error-prone FFI/interop stuff that you would have to do for every platform. However, the UX can suffer since little drifts from the native platform UI controls can end up being very noticeable, distracting and annoying. Accessibility is also a thing that needs to be completely re-implemented, which can suffer.

If they can provide as good of an experience as QT then that’s a very interesting value proposition.

1 Like

I was actually just reviewing @dnolen hello-cljsc git repo to get an idea of what the ClojureScript compiler does and how it might work with Dart. If anybody else is interested in starting up a repo to work on a CLJ->Dart compiler I would be happy to kick it off unless there is already one out there somewhere?

2 Likes

For anyone interested to work on this, Dart’s compiler has IR which is a much more simpler form, so it might make sense for cljd (Clojure on Dart) to emit Dart’s IR instead of higher level language constructs.

1 Like

I thought both QT and JavaFX were more like hybrids. In that they use as many native controls as possible as well as their own. Like I was told JavaFx uses native file pickers for example. Which is why I was saying the evolution seems pretty similar, from full native like AWT/React Native to full emu like Flutter/Swing to hybrid like JavaFx/Qt.

Is that not true? I’m no expert with any of these.

Also, would we want Dart or Flutter? I feel there’s a high chance over time other language bindings get created for Flutter the way they have them for Qt no? Or its reliance on Dart too strong?

Would there be a benefit to emitting IR over Dart itself? Would the compiler kick in and do its auto refresh if you did the IR code?

Hi Ian! I’ve been looking at this as well recently. Message me if you’re still interested in working on it. I’m geo.ciobanu<<>> gmail.com

Sure!
Been away for a few weeks but back to the grind now!