News for hackers. Stuff that matters.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by jonahbenton on Friday May 01, 2020 @09:59PM (#23048428)
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.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by dustingetz on Friday May 01, 2020 @10:19PM (#23048540)
"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...
Re:Joy: Web framework with Clojure syntax, fast startup and ... by dig1 on Saturday May 02, 2020 @06:40AM (#23050896)
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.

Re:Joy: Web framework with Clojure syntax, fast startup and ... by jgalt212 on Saturday May 02, 2020 @10:00AM (#23051818)
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?
Re:Joy: Web framework with Clojure syntax, fast startup and ... by nickik on Saturday May 02, 2020 @01:30PM (#23053387)
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.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by jgalt212 on Monday May 04, 2020 @08:23AM (#23067082)
unless you think about types the way Haskell does.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by StreamBright on Saturday May 02, 2020 @07:26AM (#23051094)
Code readability is massively underrated.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by threatofrain on Friday May 01, 2020 @08:02PM (#23047746)
Re:Joy: Web framework with Clojure syntax, fast startup and ... by swlkr on Friday May 01, 2020 @08:40PM (#23048002)
Hey! Joy made it to HN! Pretty cool, if anyone has any questions I’d be happy to answer!
Re:Joy: Web framework with Clojure syntax, fast startup and ... by Scarbutt on Friday May 01, 2020 @08:46PM (#23048051)
What happened with Clojure and Coast? ;)
Re:Joy: Web framework with Clojure syntax, fast startup and ... by swlkr on Saturday May 02, 2020 @12:38AM (#23049263)
Haha well they still work, but yeah not super active on it lately.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by jfkw on Saturday May 02, 2020 @01:29AM (#23049510)
Does jpm have an option install packages to a local environment (virtualenv)?
Re:Joy: Web framework with Clojure syntax, fast startup and ... by capableweb on Saturday May 02, 2020 @06:30AM (#23050841)
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.

Re:Joy: Web framework with Clojure syntax, fast startup and ... by GradientAssent on Friday May 01, 2020 @10:14PM (#23048517)
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.

Re:Joy: Web framework with Clojure syntax, fast startup and ... by capableweb on Saturday May 02, 2020 @04:19AM (#23050274)
> 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.

Re:Joy: Web framework with Clojure syntax, fast startup and ... by christophilus on Friday May 01, 2020 @08:02PM (#23047750)
Interesting. Anyone used Janet before? It sounds like a promising language. The fact that it supports mutable strings is a little disconcerting, though.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by DennisP on Friday May 01, 2020 @08:23PM (#23047875)
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.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by capableweb on Saturday May 02, 2020 @06:33AM (#23050855)
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

Re:Joy: Web framework with Clojure syntax, fast startup and ... by pull_my_finger on Sunday May 03, 2020 @02:19AM (#23057246)
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

Re:Joy: Web framework with Clojure syntax, fast startup and ... by cellularmitosis on Saturday May 02, 2020 @09:38PM (#23056228)
Re:Joy: Web framework with Clojure syntax, fast startup and ... by didibus on Friday May 01, 2020 @11:05PM (#23048788)
It's a neat little scripting language. Useful in the same places you'd find Lua useful.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by Scarbutt on Friday May 01, 2020 @08:54PM (#23048089)
From where do you get that strings are mutable?
Re:Joy: Web framework with Clojure syntax, fast startup and ... by threatofrain on Friday May 01, 2020 @10:06PM (#23048471)
> * Mutable and immutable strings (buffer/string)

https://janet-lang.org/

Re:Joy: Web framework with Clojure syntax, fast startup and ... by zdragnar on Friday May 01, 2020 @10:13PM (#23048510)
In context of the other bullet points, buffer is the mutable variation. I can't say that I find that to be too disconcerting
Re:Joy: Web framework with Clojure syntax, fast startup and ... by brabel on Saturday May 02, 2020 @02:48AM (#23049880)
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.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by loosetypes on Saturday May 02, 2020 @01:23AM (#23049484)
I love how the site has an embedded repl.

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

Re:Joy: Web framework with Clojure syntax, fast startup and ... by ngcc_hk on Friday May 01, 2020 @09:14PM (#23048195)
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.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by hellofunk on Saturday May 02, 2020 @03:56AM (#23050182)
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.

Re:Joy: Web framework with Clojure syntax, fast startup and ... by eyelidlessness on Saturday May 02, 2020 @12:00PM (#23052508)
> 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.

Re:Joy: Web framework with Clojure syntax, fast startup and ... by didibus on Friday May 01, 2020 @11:02PM (#23048766)
Apples to oranges. Janet is like Python or Lua, it is a scripted interpreted language. It does not compile to JavaScript.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by progre on Saturday May 02, 2020 @03:35AM (#23050103)
This is a backend web framework. Better comparison would be with Clojure+whatever they use for webservers over there.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by _bxg1 on Friday May 01, 2020 @08:18PM (#23047840)
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.

Re:Joy: Web framework with Clojure syntax, fast startup and ... by Scarbutt on Friday May 01, 2020 @08:41PM (#23048015)
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.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by _bxg1 on Friday May 01, 2020 @08:50PM (#23048072)
Gotcha. Should've read more closely.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by codesections on Saturday May 02, 2020 @06:59AM (#23050993)
To be clear: this is an entirely backend framework, with no support for writing Janet on the front end, correct?
Re:Joy: Web framework with Clojure syntax, fast startup and ... by swlkr on Saturday May 02, 2020 @09:35AM (#23051693)
That is correct
Re:Joy: Web framework with Clojure syntax, fast startup and ... by ahungry on Saturday May 02, 2020 @02:48PM (#23053961)
Awesome framework and choice of language!
Re:Joy: Web framework with Clojure syntax, fast startup and ... by swlkr on Saturday May 02, 2020 @06:28PM (#23055402)
Hey thanks! Yeah janet is a great language!
Re:Joy: Web framework with Clojure syntax, fast startup and ... by sansnomme on Friday May 01, 2020 @08:09PM (#23047787)
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.

Re:Joy: Web framework with Clojure syntax, fast startup and ... by vga805 on Friday May 01, 2020 @08:13PM (#23047812)
do they really need to fix syntax highlighting? for such a small snippet on a framework landing page, it seems fine.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by sansnomme on Friday May 01, 2020 @08:53PM (#23048081)
And this is why so many Lisps fail. Lisp creators do not give a damn about "gimmicks" like a pretty landing page.
Re:Joy: Web framework with Clojure syntax, fast startup and ... by vga805 on Friday May 01, 2020 @09:08PM (#23048152)
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
Re:Joy: Web framework with Clojure syntax, fast startup and ... by swlkr on Friday May 01, 2020 @08:40PM (#23048010)
I do have plans for auth, still thinking about the best way to solve it though