Volt: A reactive web framework where your Ruby code runs both server and client
voltframework.com
voltframework.com
But I will say that in terms of productivity, Clojurescript/Reagent has been a real red-pill experience. Functions that compile to both back-/frontend. Seamless data-transfer via Transit (access front-end vars from the backend, no conversions - and simple cljs function compiling directly to React components is a very potent cocktail.
So let's use the words of others instead, here is the best explanation I know about why the Clojure REPL rocks: https://vvvvalvalval.github.io/posts/what-makes-a-good-repl....
Short version is: you can send snippets of code to your REPL from your editor, and because of the common structure of Clojure apps, you can usually evaluate content in the middle of a function without having to change any code. Basically unlimited introspection into a running program.
I used to program in PHP, C#, Golang, Ruby, NodeJS/JavaScript (both backend/frontend) and some others, and no language comes close to the dev experience of Clojure. I'm sure other lisps are similar as well, but haven't used anything else than Clojure substantially.
If you did get into the REPL workflow, was it not helping you be more productive? Any showstoppers?
Also, I take issue with a language that touts itself as purely functional, but then builds itself off of the JVM, forcing you to use objects under the hood. You end up with some kind of weird FP/OO Frankenstein's monster that isn't _really_ FP, but also isn't _really_ OO. Also, since it is on the JVM, there is _no way_ you can actually have truly immutable objects or data structures, as much as Clojure likes to think that is the case. It places a lot of trust on the libraries that make up your program not to go into reflection and do some really annoying mutations.
If that is the case, I'd rather just use something like Erlang or Haskell which are _truly_ functional languages, not just an OO system masquerading as a functional language.
I _really_ like the syntax of lisp, and Clojure provides some really good extensions of that syntax with the way they do parameters, but in the end I just couldn't get over the issues I had with the core of the language runtime.
> Also, I take issue with a language that touts itself as purely functional
Seems to be a common misconception that still hasn't died.
Clojure doesn't tout itself as a "purely functional" language, and as far as I know, never has. It tout itself as a "practical general purpose" language where you can be pure and impure, depending on what you do.
What Clojure does advocate for, is the approach that _most_ parts of _most_ programs should functional, but you should be able to go away from that paradigm when required/wanted.
> It places a lot of trust on the libraries that make up your program not to go into reflection and do some really annoying mutations
Just for the record, in reality and practical terms, I've never had this happen to me. Now I haven't done Clojure development for more than 2 years or something, but if it was a real problem, I'm guessing I would have hit this at least once before. But never have I had a Clojure library unexpectedly mutate things it wasn't supposed to.
So yeah, if you're looking for a purely functional language, go with a language that actually tries to be purely functional, because that's not what Clojure aims for, it aims for practicality.
Even if you are used to java, the exceptions and stack traces in Clojure still don't make sense. This is coming from someone who was writing Java in their day job while learning Clojure at home.
> Seems to be a common misconception that still hasn't died.
Probably because it is not a misconception?
Right on the Clojure main site, it states it is a functional language, and that Object Oriented programming is overrated. With the language being built on top of the JVM you _cannot_ avoid objects (the bytecode generated by Clojure is riddled with objects). Clojure is a language that claims to be functional while building its foundations upon one of the most well-known object-oriented systems out there.
This is like building a house on top of a concrete foundation, laying some boards over the top to cover it up, and claiming the house is 100% wood. It just....isn't.
It also makes the claim that Clojure data structures are immutable. That is 100% not true, as ANY object or data structure can be mutated on the JVM at runtime with reflection.
If Clojure truly doesn't aim to be a functional programming language, then maybe they need to update their website.
> Just for the record, in reality and practical terms, I've never had this happen to me.
If you use any java libraries in your Clojure projects, there is a very high chance you will run into this. One of the 'strengths' that Clojure lays claim to is being able to leverage the Java ecosystem, while at the same time apparently also claiming that you shouldn't use libraries from Java (or if you do, write a wrapper for it).
> Clojure is a robust, practical, and fast programming language with a set of useful features that together form a simple, coherent, and powerful tool.
> Clojure is predominantly a functional programming language
https://clojure.org/about/functional_programming
> Clojure is impure
> most parts of most programs should be functional
In the end, it doesn't matter what you can do deep down in the JVM. In Clojure land, the data structures you pass around are (mostly) immutable, unless when you use explicitly mutatable data structures.
If the former, the usual thing in Clojure is to make an abstraction layer for them that doesn't leak mutability into your code (or just skipping those libraries altogether if that doesn't work). But of course some things are just inherently side-effectful anyways, where you have to be mindful to isolate/refactor things like IO the edges of the system.
(And yep to echo a sibling comment, Clojure is not a purely functional language, and doesn't pretend to be one)
im referring to, at runtime, literally _every_ data structure you use in Clojure is an object.
In certain scenarios, the object boxing does come with a high pricetag in terms of performance, but there are always ways around it and usually only a few functions need tweaking. I will concede however, that those few functions typically end up losing their elegance.
But basically there is a massive difference. Basically the Clojure REPL is not another process you type into, then you copy paste code into your editor. No, you usually write code like you do in your editor, then you can select snippets of code that gets evaluated in the REPL, in the context of your application, with all the running state already there.
I advice you to take a look at the link in my previous comment, which explains it better than I can, and also adds more information about why the Clojure REPL is so different, especially if you embrace it in your development workflow.
In case you missed it, here is the link again: https://vvvvalvalval.github.io/posts/what-makes-a-good-repl....
(replying as a sibling as I suppose we have hit maximum depth)
Im overdue for a blogpost on my Webdev setup/stack, but in short the main power comes from
1) Seamless transfer of data from back- to frontend and vice versa. If my DB contains a DATETIME I can load this in Clojure as a java.sql.Timestamp and pass it to the browser where its converted to a js/Date - Free data-sharing between front- and backend is a big productivity boost.
2) My usual backend Cloure code, also works in the frontend. That means I can move functions or use libs in the browser that also work in the backend - It also means that my Javascript code is now fully functional, which means 10x shorter and about 10x more robust.
3) Everything is REPL driven. Anything surprising happens in the browser I can inspect those vars that are effected in the REPL, toy with them, fix problems and update instantly. Hunting bugs is much faster this way.
4) Clojurescript functions compile to React components, zero boiler-plate: (defn banner [img txt] [:div.bannerclass [:img {:src img}] [:h1 txt]]) as an example. Thats a complete component, it will only update when the params update.
But like I said, its a bigger talk that I'll hopefully have some time to dive into sooner rather than later.
Very interesting!
A quick search did not yield any results. Could you provide a link to some article or code examples explaining this?
Otherwise the canonical source is here: https://github.com/cognitect/transit-format
Unfortunately the blog does not have dates but the last update on the repo is 5 years ago.
I believe this project is basically dead.
EDIT: This is the post from the maintainer I remember seeing: https://github.com/voltrb/volt/issues/357
Hmm, I just checked and it looks like it hasn't seen much work lately either.
Volt is a reactive web framework where your Ruby code runs both on the server and the client (via opal).
Opal Ruby to JavaScript Compiler It is source-to-source, making it fast as a runtime. Opal includes a casino comparison compiler (which can be run in any browser), a corelib and runtime implementation. The corelib/runtime is also very small.
it should go to https://opalrb.com/
"Opal Ruby to JavaScript Compiler It is source-to-source, making it fast as a runtime. Opal includes a casino comparison compiler (which can be run in any browser), a corelib and runtime implementation. The corelib/runtime is also very small."
Casino comparison compiler?!
1. no friction thinking for thinking about communication between the frontend and backend.
2. js interop has been great. The hooks system allowed me to seamlessly plug in dropzone and stripe elements while keeping the rest of the frontend as elixir.
3. I can have the frontend pages react to pubsub channels and react to events from other parts of the system and update the page instantly.
3. super fast with SSR.
Otherwise I really like the idea of LiveView / LiveWire / StimulusReflex, cant wait to see it mainstream.
Then just share the database connection between these elixir servers.
The latency between the edge servers and the database server will give you bad UX with current "mount/3 gets called twice" strategy. Going from edge to db twice is really bad in my experience. Now you would think about adding read-only postgresql nodes on at least 3 nodes (US, EU, and Asia), $$$$.
Isn't the issues pretty much the same for normal single page apps as well? Most single page apps require data loads for many actions causing maybe not interface latency, but rather data load latency.
While I am sure there is a shit load of edge cases that would make this very hard to fully solve for all cases, I feel like a generic promise-like-structure shared between backend and frontend would already go a long way here.
You can do optimistic UI and interactions that don't warrant a round trip to the server like toggling a drop down.
See the blog posts below. They explain it really well.
http://blog.pthompson.org/liveview-tailwind-css-alpine-js-mo...
Anyone has any idea why? Watching the youtube video of "Building a Todo" using Volt from 2015 brings me back to my memory of seeing the Youtube video of Rails for the first time.
But writing frontend (and Webpack-friendly!) code in Ruby is still fun, which is why the modest ambitions of the Ruby2JS project excite me and I'm happy to contribute to that project nowadays.
See Volt DB, an in-memory database that's been around for 10 years and raised $41M. Registered trademark.