Hacker News new | past | comments | ask | show | jobs | submit

Why Janet? (2023)

https://ianthehenry.com/posts/why-janet/
This post is refreshing - smells of the pre AI discussions on the internet. A new language, a new syntax, heavy debate with people who have spent years writing code. I think someone should start a community online where AI isnt allowed.
> I think someone should start a community online where AI isnt allowed.

In case you haven't followed the saga, the latest[1] digg.com relaunch failed because they couldn't deal with the bot onslaught [2]. Whoever finds a reliable way to keep AI out of an online community first is likely to become a very rich person.

[1] Second-to-last, actually, seeing as there seems to be a new homepage right now.

[2] https://www.techspot.com/news/111698-digg-relaunch-fails-two...

loading story #48368738
loading story #48368409
loading story #48368434
> a new syntax

How is the syntax new?

It looks like lispy - see the outer parens in the examples given.

loading story #48368718
It’s been a few months, but I built a tool by Janet lang to communicate with an LLM via HTTP. Of course, I probably had Claude Code write it for me. It turned out better than I expected.

I was really impressed by how small the executable file was. I’d only ever done web development with Node.js up until then.

loading story #48370306
loading story #48368812
Always nice to see janet getting some attention.

shout out to one modern feature: sandbox

"Disable feature sets to prevent the interpreter from using certain system resources. Once a feature is disabled, there is no way to re-enable it."

https://janet-lang.org/api/misc.html#sandbox

loading story #48369056
loading story #48369315
loading story #48369150
> But by allowing you to unquote literal functions, Janet makes it possible to write macros that are completely referentially transparent.

These lisp guys really get excited over very abstract things. If you say this to an average person on the street they will probably try to run away.

you ever try to explain object oriented programming languages and their benefits to the "average person on the street"?
loading story #48368171
loading story #48368521
loading story #48369081
I've been drawn into the Janet posts that surface every once in a while here on HN, but found the otherwise highly praised "Janet for Mortals", not being for mortals at all.
loading story #48368681
loading story #48368519
> not being for mortals at all.

I had that with Haskell. Although, while Haskell is too hard for me, I actually like its syntax.

Janet seems to be Lisp 2.0, so the syntax is lispy.

Seems some of the listed advantages for Janet would also apply for tcl (small/simple, easy to learn, embeddable, usable as a shell, great for domain specific languages). It would be interesting, to me at least, to see a fan of Janet compare the two.
I've only used Tcl briefly, mostly for automation which it's great at. But it's a Algol-like imperative language, doesn't have any type of macros and makes everything based on strings (which makes sense for automation) instead of lists, with all the tradeoffs that comes with.

It seems easier to figure out what the similarities are, because I think they're pretty few, they seem to differ more than they are similar.

loading story #48369965
loading story #48370082
> Instead of regular expressions, Janet’s text wrangling is based around parsing expression grammars. Parsing expression grammars are simpler, more powerful, and more predictable than regular expressions.

I would dispute that this is the case. In PEGs, alternatives are not commutative, unlike in regular expressions. This can lead to quite frustrating debugging. While a valid choice, the advantage over REs is overstated.

loading story #48368675
loading story #48368427
loading story #48368569
Came here for this comment. Janet would score positively in my mind if the evolutionary dead-end PEG were replaced with a grammar parser that is known to work under all circumstances.
loading story #48369982
This got me thinking of Hy. I wonder how syntactically close they are; there might be an exploitable Python -> Hy -> Janet path here.

[0] https://hylang.org/

I used Hy for a long time, then tried Janet, and ultimately realized that I wanted more batteries included but didn't want Python... So I forked https://github.com/rcarmo/go-joker and am tinkering with it until it does all I want.
loading story #48369247
loading story #48368864
loading story #48370003
Maybe needs a (2023) in the title?
loading story #48370255
The embeddability sounds very appealing. Does anyone have experience with using this somewhere one might traditionally reach for Lua?
I have built a markup language with embedded scripting in Janet. I originally tried to use Lua, but found the verbosity extremely frustrating.
loading story #48370188
loading story #48372203
Pretty compelling, especially "Janet does not adhere to the ancient customs. CAR is called first. PROGN is called do. LAMBDA is fn, and SETQ is def." - a sign of good sense for sure!

How fast is it?

Also my main objection to Lisps is still the horrible bracket syntax. Yes it's unambiguous and easy to parse, but it's HORRIBLE to read and edit. I wish this project had been a success (or something similar to it): https://readable.sourceforge.io/

Also I don't think static typing is really optional for me at this point.

> Pretty compelling, especially "Janet does not adhere to the ancient customs. CAR is called first. PROGN is called do. LAMBDA is fn, and SETQ is def." - a sign of good sense for sure!

Just FYI, many of these are also done in Scheme and its derivative Racket. They kept lambda (but even Python did that), but progn -> begin, setq -> set!, car -> first, and so on.

> Also my main objection to Lisps is still the horrible bracket syntax. Yes it's unambiguous and easy to parse, but it's HORRIBLE to read and edit.

I have pretty mixed feelings at this point. I don’t mind it for normal programming, but when I do numerical programming (physics models, etc.) you often get extremely long and verbose expressions that are IMO difficult to parse compared to the math-like infix operator notation used in other languages.

I'm starting to prefer the s expression syntax when dealing with tree structures like json.

I wonder if we were raised on tree based algebra if math would be easier to do, or harder.

Like, solve for x.

   (= (+ (* 2 x) 3) 11)
   (= (* 2 x) (- 11 3))
   (= (* 2 x) 8)
   (= x (/ 8 2))
   (= x 4)
Though this isn't too bad.

    (= (+ (pow x 2)
          (pow y 2))
       (pow r 2))
loading story #48368534
loading story #48368661
Syntax is not that important to me. I prefer Python style indentation, but its really not that important - its just something to get used to for me.

Is static typing that important for a scripting language? From the intro to the book:

> And to be clear, I’m not going to try to convince you to bet your next startup on Janet, or even to use it in any sort of production setting. But I think it’s an excellent language for exploratory programming, scripting, and fun side projects.

loading story #48369795
loading story #48369398
Luxferre.top has some Janet based softwrae.
loading story #48370322
Excellent. Although I suspect the author of the programming language invented this Janet for all the perfect puns. Yes, Janet. No. Janet.
loading story #48369004
loading story #48368778
{"deleted":true,"id":48368535,"parent":48367907,"time":1780397766,"type":"comment"}
loading story #48370530

    (defn foo [first & rest] ...)
So basically Lisp 2.0.

Although, this here is a good idea:

"pass values from compile-time to run-time"

Would be nice if some kind of "scripting" language be as fast as a compiled language, but without ruining the syntax. Just about 99% of the languages that are shown, have a horrible syntax. Syntax is not everything, but most language designers don't understand that syntax also matters. So tons of horrible languages emerge. Nobody will use those languages, so 99% of them will die off quickly.

loading story #48368642
loading story #48368582
loading story #48369787
why is it called Janet? perhaps to prevent it to be identified with the acronym for Lots of Irritating Single Parenthesis?
loading story #48368628
loading story #48368611
loading story #48368530