10 ms·
Show HN: Programming Google Flutter with Clojure
This proof-of-concept project combines:
- Flutter, from Google;
- ClojureDart, port of Clojure to Dart from Tensegritics; and
- Matrix, a reactive framework from moi.
So, yes, we can now program Flutter with a Lisp. Yay.
Project includes dozens of working examples and a full implementation of the TodoMVC classic to help tire-kickers play around.
Support installing freely available on the #matrix channel on the Clojurians Slack.
- detente20 4y agoThis is so cool!
- xcambar 4y agoWith full REPL support etc? (Please say yes, please say yes, please...)
- cgrand-net 4y agoNot yet but we are working on it. Sponsor ClojureDart to make it happen sooner! https://github.com/tensegritics/ClojureDart https://github.com/tensegritics/ClojureDart
- cfiggers 4y agoFWIW, I tried ClojureDart a little while back, had a good time, but thought to myself, "I'll be back when they have a REPL working." At that time you guys were saying things in the Slack like, "We already have a working prototype behind closed doors, it just needs polish. We'll be ready to release it soon." It was very exciting. That was... six months ago. :) So... I guess I'll keep waiting.
- kennytilton 4y ago(a) Is six months a long time? (b) And then they delivered successfully. (c) Not seeing a problem. I know, I have been beating on CLJD like I was its Daddy wrapping it in a reactive framework, despite their warning that there would be surprises. I had one problem that turned out to be a simple bug in CLJD. I also follow their channel on the #clojurians Slack and see they are doing a profoundly deep job on the compiler. This means a robust product, not one that has developers forever looking over their shoulders at the language they are using. Six months for that is nothing. Now send them eight dollars. jk. :)
- deleted 4y ago[deleted]
- eduction 4y agoYou posted this as a reply to cgrand saying they would need resources to go any faster. Yes it’s not ready yet so you’ll need to wait (or provide resources). Paraphrasing your memory of their prior time estimate on Slack seems a non sequitur - what is your intended point?
- cfiggers 4y agoParent comment says: REPL is a priority to me, do you have that? cgrand's comment says: Not yet, but probably soon! Here's a link to donate My comment says: Before you donate, here's some context for what "soon" likely means Your comment says........?
- eduction 4y agoNo cgrand didn’t say it’s coming soon, he said they’re working on it and donate to get it “sooner.” Is it possible you are having similar accuracy issues recalling what he said on Slack months ago?
- deleted 4y ago[deleted]
- kennytilton 4y agoIt's my fault. And other active users. Tensegritics polled us on what we wanted first -- Tensegritics is neither Oracle nor Google -- and we all had a REPL in last place. The one caveat I offered was "...but a REPL will be a selling point!" ROTFL Seriously, when I want a REPL I hack the test code into "main" and comment out the UI launch. Then I edit and save and the output goes to my terminal nearby thanks to auto build/restart.
- kennytilton 4y agoYep, REPL is always great, but tbh even with ClojureScript (atop JS) I have never taken the trouble to figure out how to get a CLJS REPL going, though I am told it is possible. :) Instead I get by with sub-second recompiles/reloads and print statements. It works great, tbh. That said, Tensegritics is working on it.
- 100phlecs 4y agoWhen working with Flutter I did dream "It would be pretty amazing to have a Lisp on top of this" - awesome work you're doing here! Lots of interesting stuff happening in the Clojure space lately. https://github.com/squint-cljs https://github.com/squint-cljs It's a strange thought, but I wonder if Clojure (or rather, the clojure community) would somehow "migrate" from the jvm at this rate.
- deleted 4y ago[deleted]
- simongray 4y agoNo one is "migrating" anywhere. Clojure has always been about being hosted on different platforms. The best Clojure development experience is probably full-stack Clojure, i.e. JVM Clojure on the backend and ClojureScript on the web—and perhaps ClojureDart for apps. People are implementing Clojure on different hosts because they love the language and want to use it in other contexts, not because they don't like the JVM. I actually wrote about this phenomenon a few years ago and it reached the top of HN: https://news.ycombinator.com/item?id=22458827 https://news.ycombinator.com/item?id=22458827 I should probably revisit the topic again, since much has changed in the meantime.
- 727564797069706 4y agoMy dream is Clojure hosted on Rust. It's because Clojure isn't intended to "hide away" the platform underneath and you interact with the platform quite a bit. Since I prefer Rust ergonomics over Java/JVM ergonomics, it'd be awesome to have Rust as a Clojure platform. One day it will happen - if not by me, then by someone else, I'm sure!
- jiyinyiyong 4y agoI built a Clojure dialect in Rust called Calcit https://github.com/calcit-lang/calcit https://github.com/calcit-lang/calcit . It's ClojureScript at core, despite its indentation-based syntax.
- pjmlp 4y ago
- chairhairair 4y agoInteresting! Would love a video including your workflow w/ emulator.
- kennytilton 4y agoWill do! Any specific things you like to see in workflow vids? Otherwise I'll just do the obvious stuff. I will reply here when I have something for y'all.
- kennytilton 4y agoThe tl;dr is, on the Mac, (1) start their Simulator app; (2) start a build with watch in the app root directory; and (3) edit code as usual (IntelliJ/Cursive). The app rebuilds/reloads on save. Tensegritics is looking at better hot reloading; I am happy with automatic full restarts. Flutter offers a couple of endpoints to visit for debuggers, but I just live off print debugging in the build console. Video ASAP.
- kennytilton 4y agoVoila! https://www.youtube.com/watch?v=qQiTfIc7nDo https://www.youtube.com/watch?v=qQiTfIc7nDo Please let me know what else you might like to see.
- LarsDu88 4y agoAh Flutter. I burned a month making silly apps with it, but then I realized that I would probably be better off learning any other programming language than Dart (careerwise at least)
- piyush_soni 4y agoYeah. C++/Rust, or (slightly far fetched) C# support would be so awesome!
- account-5 4y agoHow come? What's so bad about dart?
- virtualwhys 4y agoOff the top of my head, no access modifiers (so private variables, for example, are prefixed with `_`, by convention, not enforced by the compiler), no pattern matching (and obviously no exhaustive matching), no record types, no sum types, no json (de)serialization (requires 3rd party libary code gen, wow), mutability everywhere, everything is a statement (i.e. no implicit `return`, AKA everything is an expression), required semi-colons (which they'd like to get rid of but can't due to questionable design decisions made long ago -- for the gory details see here[1]). If you like Java 8 and earlier you'll probably feel at home with Dart. Obviously I'm biased, but I find Dart to be one of the most unpleasant languages I've had the misfortune of being exposed to; this despite Flutter and its instantaneous hot code reloading being quite amazing -- a bizarre mix of promise and despair. [1] https://github.com/dart-lang/language/blob/master/resources/optional-semicolons-prototype.md https://github.com/dart-lang/language/blob/master/resources/...
- kennytilton 4y agoAs a Dart/Flutter outsider myself, I am finding all this "Dart no, Flutter yes" traffic intriguing. I am also a lisper, so no need to sell me on the difficulties of Dart, even if it were the perfect static typed OO, but it sounds like we have a great UI stuck inside an unloved language. Happy opportunity for ClojureDart! btw, in case anyone is wondering, I am not a part of Team CLJD at all. My hack is my own separate effort.
- FailMore 4y agoAre you basically saying that I can build my front end using clojure? I really want to learn clojure and use flutter for a personal project... are there are any reasons not go down this path? (E.g. the "official" implementation of flutter is more secure?, etc.) Thank you for the cool project
- fulafel 4y agoBuilding your frontend in Clojure has been possible for a while, see this announcement 11 years ago: https://www.clojure.org/news/2011/07/22/introducing-clojurescript https://www.clojure.org/news/2011/07/22/introducing-clojures... ClojureScript & the user base has since steadily grown and improved and people have been shipping serious production applications with it for a long time now.
- silver-arrow 4y agoFor sure. You could also build front-ends with Clojure using htmx. It really simplifies building dynamic front-ends by allowing you to return to the hypermedia model with server-side rendering. It has been fantastic. No ClojureScript. Just a normal Java Clojure REPL. https://htmx.org/ https://htmx.org/
- kennytilton 4y agoI believe Tensegritics already has an app up on the app store based on early ClojureDart. I run screaming before apps have to be deployed, so please check with them on that. They hang out on the Clojurians Slack. My reactive hack is over twenty years old so it is pretty solid, should be OK if you want to throw that into the mix. ps. You are welcome!
- kennytilton 4y agoAnswering another question about Flutter variability I remembered that that variability requires a bit of custom wrapping per widget for Matrix goodness. ClojureDart is fine, but my Matrix macros try to bring in a little HTML-ish uniformity. Matrix has many widgets yet unwrapped, but I will document the wrapping process and support any user by doing the wrapping myself. I also have in mind developing a Dart tool to generate wrappers automagically. tl;dr: ClojureDart is in great shape, Flutter/MX is solid but needs more widgets wrappe.
- mark_l_watson 4y agoHello Kenny, that looks cool. I will try it later today. I was very keen on Flutter a few years ago until a version bump broke my one application and I never spent the time to fix it. Clojure is far from my favorite Lisp, but I like it well enough. What will sell your project to me is how nice the dev process is. I love Common Lisp and Scheme dev process, but I struggle to get the same level of happiness with Clojure. Looks like a nice project!
- kennytilton 4y agoMark! How are you! Yes, my heart belongs to Common Lisp, but Clojure has macros and the parens are in the right place..."well enough" says it all. I hang mostly on the Clojurians Slack if you get stuck, #clojuredart or #matrix channels.
- phrmoy 4y agoConsider: https://flet.dev/ https://flet.dev/ + https://coconut-lang.org/ https://coconut-lang.org/ TL;RD; Functional Python on top of Flutter From https://github.com/flet-dev/flet https://github.com/flet-dev/flet: " Deliver to any device Deploy Flet app as a web app and view it in a browser. Package it as a standalone desktop app for Windows, macOS and Linux. Install it on mobile as PWA or view via Flet app for iOS and Android." From https://coconut.readthedocs.io/en/latest/HELP.html https://coconut.readthedocs.io/en/latest/HELP.html: "Specifically, Coconut adds to Python built-in, syntactical support for: pattern-matching algebraic data types destructuring assignment partial application lazy lists function composition prettier lambdas infix notation pipeline-style programming operator functions tail call optimization where statements"
- kennytilton 4y agoWow! Coconut alone looks impressive. Is there a state management solution in there? I looked at the Todo app and it looked like manual change propagation.
- amgreg 4y agoIn folks' opinion, what are the best resources to learn Flutter beyond the official docs? The official docs are pretty solid but I am looking for something else — maybe a book?
- kennytilton 4y agoBy popular request, a video[0] of my workflow using ClojureDart and Matrix to live code Flutter. The last few minutes show me probing a new bug! I experiment, and find a partial workaround that hints at a solution. [0]: https://www.youtube.com/watch?v=qQiTfIc7nDo https://www.youtube.com/watch?v=qQiTfIc7nDo