Hacker News new | past | comments | ask | show | jobs | submit login
Joy: Web framework with Clojure syntax, fast startup and low memory usage (joyframework.com)
178 points by galfarragem on May 1, 2020 | hide | past | favorite | 43 comments



Love passion projects, and love Clojure and its syntax, but wish some folks would pick up on Spec and on predicate-based data flow definitions. That is what I miss most in other languages.


"predicate-based data flow" is something I haven't heard before, what do you have in mind? I agree that clojure.spec2 can probably generate UI ... This gist is where Hyperfiddle DSL is roughly at right now but I think the Datomic schema definitions can be replaced by specs and the pull queries by s/select https://gist.github.com/dustingetz/96c928f755c736d2b525bb61a...


Spec has it's place, but I think people are trying to shovel spec in all sort of places; for example, heavy data parsing, making code very hard to track. Reminds me on core.logic movement couple of years ago, where everyone tried to have own parser/ui/whatever written in it, resulting very unreadable code.

What I'm really missing from spec is ability to disable it with flag or property, like "assert" macro. Sometimes I just want piece of code to run as fast as possible with less bytecode and instructions executed.


Isn't spec just a way to bolt on types to a dynamic language? And if you look at this way, can one have its cake and eat it too?


Thinking about Spec like a type-system is really not the right way to think. Its more dynamic validation system that works like regex for data-structures.


unless you think about types the way Haskell does.


Code readability is massively underrated.



Hey! Joy made it to HN! Pretty cool, if anyone has any questions I’d be happy to answer!


What happened with Clojure and Coast? ;)


Haha well they still work, but yeah not super active on it lately.


Does jpm have an option install packages to a local environment (virtualenv)?


I'm not hugely into Python, so not sure about the details of virtualenv, but if you want to install packages fetched by jpm in a different directory, you can set `JANET_PATH` to where you want them to go.

So doing `export JANET_PATH=$pwd/packages` would put them into `./packages` from your current working directory.


I'm working on a project right now where the centerpiece is a Three.js scene. It's about data visualization, so the surrounding code covers much of the same ground as a typical single-page web app: fetching data, UI for manipulating the dataset, etc.

I decided not to use my beloved Clojure and re-frame because it seemed like I was going to end up wrestling with Three's imperative API.

Others inclined toward projects like the OP and the Clojure ecosystem more generally: how have you approached similar projects before? Where there's a very non-Clojure-native library that will be critical?

I ended up with TypeScript, React, and Redux instead of re-frame.


> how have you approached similar projects before? Where there's a very non-Clojure-native library that will be critical?

Started playing around with Arcadia which is Clojure-CLR + Unity3D tooling/library. Basically used for make some interactions with the Unity3D framework easier.

While most of the code is using interop, having the repl flow is something that for me, after using Clojure professionally for a while, is really really hard to give up. I've tried getting into game development before, but the slow iteration cycles on "make change -> save -> do thing to test" just sucks all the fun out of it.

If I were to use Three.js in a project, I'd approach it the same way. As I try to stay far away from any other languages, I'd write a small layer between my CLJS code and the Three.js API, the smaller the better, and then use that.

Because giving up on being able to eval whatever and having access to a repl is not worth it in the projects I work with.

Basically, any hurdle (like basing my project around a non-CLJS library) is easier to overcome than having to deal with something like TypeScript again.


Interesting. Anyone used Janet before? It sounds like a promising language. The fact that it supports mutable strings is a little disconcerting, though.


I haven't yet but I think I will, partly because I've always been intrigued by lisps. Also, I hope they never change their logo, which looks a lot like my late mother did when she was young. She was also named Janet.


That's a nice coincidence :)

Seems the inspiration for the name comes from The Good Place, and the logo seems different enough that they won't sue the owner of the project, as the face in the logo is not that similar to Janet from the TV show.

> Why Janet? Janet is named after the almost omniscient and friendly artificial being in The Good Place


Why is that a problem? Most of the data types have mutable and immutable variants. buffer -> string, table -> struct, array -> tuple. The mutable variants have a `@`.

https://janet-lang.org/docs/syntax.html



It's a neat little scripting language. Useful in the same places you'd find Lua useful.


From where do you get that strings are mutable?


> * Mutable and immutable strings (buffer/string)

https://janet-lang.org/


In context of the other bullet points, buffer is the mutable variation. I can't say that I find that to be too disconcerting


It is not disconcerting. It is necessary if you want to perform string operations efficiently. Java has String and StringBuilder for the same purpose. Rust has str (always static, immutable) and String (can be mutable). This is very common in non-scripting languages.


I love how the site has an embedded repl.

Anyone know if there’s a preferred way to implement this?


The major question is how Janet compares with clojurescript. A quick look it seems at least it is easier to setup. Anyone know how Janet cf with clojurescript.


There have been a couple of comments here asking a question like this, and it makes me realize that most people don’t actually know what clojurescript is.

Clojurescript is not some kind of scripting language on top of clojure, it is the clojure language that compiles to JavaScript, usually for running on the front end.


> it is the clojure language that compiles to JavaScript, usually for running on the front end.

Being super pedantic (probably unnecessarily), it's the Clojure syntax for a subset of the Clojure language, plus some additional syntax and functionality specific to JavaScript interop.


Apples to oranges. Janet is like Python or Lua, it is a scripted interpreted language. It does not compile to JavaScript.


This is a backend web framework. Better comparison would be with Clojure+whatever they use for webservers over there.


I'm skeptical of any framework that brings its own new syntax. That means an enormous additional overhead of documentation, support, and dev tool integration, which doesn't tend to go well without a critical mass of end-users.

What's weird to me about this one is that it's "with Clojure syntax" but isn't just a ClojureScript library? I guess the Lisp syntax makes the parsing step easy, at least.


The framework is not using its own syntax, it is the syntax of Janet. It has Clojure syntax because it's written in Janet which is a Clojure inspired Lisp.


Gotcha. Should've read more closely.


To be clear: this is an entirely backend framework, with no support for writing Janet on the front end, correct?


That is correct


Awesome framework and choice of language!


Hey thanks! Yeah janet is a great language!


You need to fix the syntax highlighting and code rendering on the landing. Use a monospaced font and a different background colour. Monokai is a good choice.

Any plans for auth? It is a weakness of a lot of web frameworks.


do they really need to fix syntax highlighting? for such a small snippet on a framework landing page, it seems fine.


And this is why so many Lisps fail. Lisp creators do not give a damn about "gimmicks" like a pretty landing page.


to the contrary, i disagree with your premise that it isn't a pretty landing page. i honestly dont think the code snippet needs to be fixed, thats all


I do have plans for auth, still thinking about the best way to solve it though




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: