I was a donator to Janet for a little while and then eventually stopped.
I think it would be a great programming language if it arrives 5~10 years earlier. Highlights to me are: green thread, TCO, easy distribution, great interop with C, flexibility of choosing between imperative vs immutable data structures.
However, I just couldn't find a good use case for it. For embedded programming, I would always choose Lua if not using Zig/Rust directly. For low latency backend stuff, I can use Clojure or NodeJS, which are much more performant and mature (Janet's performance is roughly on the same level with Lua without JIT).
For general latency insensitive backend projects, there are just too many choices nowadays and Janet doesn't shine enough.
If it arrives 10 years ago with these feature sets, I would love it!
Thanks you very much for the support, I can totally understand that position.
We have been making great progress in terms of features since then to "flesh out" the languages and libraries including threading support, an event loop, and some basic networking (socket) support built in to the runtime. Generally though, the PL design space is already incredibly fatigued an most new languages claiming something have already been made a few times over, just doing doing one thing slightly better, so it is true we cannot truly compete in that space.
Janet is a hobby lisp(?) taken too far and I have been adding lots of features that I find useful for day-to-day programming and experiments while still being something "embed-able" into another project. Janet is not a corporate project in anyway and donations are accepted mostly as a token of gratitude and expenses used to maintain the website and CI bills. My goal is really just to make it a good, clean, useful language for my own use and not as some kind of advertisement or product for anything, it is a project I started in my college dorm and have continued working on as a passion project since.
Thank you for creating Janet. It is a fun language and it's exciting to watch it evolve. With the addition of the event loop and networking I'm curious to know if an http client and http server based on these will be added in the future?
I am aware that there are already libraries that cover these to an extent like circlet and halo for http. Joy also features an http client. Maybe it's outside the scope of the project, but I think an http server and client as part of the core would really add to the utility of Janet. It would also answer some of the licensing questions for distribution if these were included directly in Janet core. For example, circlet is MIT, but it is based on mongoose is GPLv2.
Also, seeing Janet on HN a year or so ago was what got me to watch The Good Place, so thanks for that as well.
I once worked on a project at a FAANG where we had to run an app on a 600Mhz CPU with no FPU. Javascript (v8, spidermonkey) wouldn't cut it (for some reasons function calls where very slow amongst other things). While Lua was incredibly fast on that hardware and the VM footprint was also a blessing. Even better, we could send a binary blob of the Lua VM/app state over the wire, and so we could precompute the whole app start on a server and send that to the device (the app would start in under 5 secondes instead of minutes as it would just load the blob). Best hacking time of my career, thanks to Lua.
Embedded is a fuzzy category, specs range from <1kb Ram to the low megabytes. Some people even extend it till low end smartphones and things like raspberry pies which are like gaming PCs by mid 2000s standards.
Lua is extremely lightweight and portable. The interpreter doesn't exceed 500 kb in the fattest build, and the used dialect is a strict subset of ANSI C that is equally comfortable running on mainframes as on Nintendo consoles.
In short : If it has a C compiler and can spare 300 kb ram, it can run Lua. So people sometimes use it there.
>Embedded is a fuzzy category, specs range from <1kb Ram to the low megabytes.
After a career in embedded software, I'd have to say that I've only worked on a couple of products that had less oomph than a high-end PC of the same era.
Indeed (see also "embedded Linux" being a thing), people insisting if something doesn't run on a tiny PIC it can't be useful for "embedded" is a pet peeve of mine.
Depending on the context, "embedded systems" go even larger, although usually people stop calling it "embedded programming" at some point. Obviously many problems in large embedded systems are different from small ones, but others remain similar.
I imagine they are annoyed because it used to be more clear, easier to google, etc. The discussion and search space was polluted for them as the meaning of the term changed, and no new term filled the void.
My counterpoints would be e.g. QNX and vxWorks, famous embedded OSes, both being active in the 90s (roots go to the 80s, but in both cases afaik they really came into being and found a market in the 90s). Plenty 90s embedded hardware with x86 CPUs in it.
What's probably different today is that you have more options also on MCUs (not just assembly and maybe C), because MCUs have grown.
Janet is a cool language. Back in March, we managed to port it to Cosmopolitan Libc so you can build Janet code as an Actually Portable Executable. Here's the diff you need: https://github.com/janet-lang/janet/compare/master...ahgamut... The Janet team helped us identify a lot of things we needed improve with our C library implemention too! While we've ported other languages too, like Python, Lua, etc. those users will still owe much thanks to Janet.
That is cool! Other commentators were asking about good use cases, and living in Cosmopolitan seems to fit the bill.
I like the language, except I have never liked the “low parenthesis” Common Lisp loop/for macros, which Janet’s “for” loop reminds me of. Pardon the stylistic nit-pick.
To be clear: do you package the Janet runtime + Janet code into a single run-anywhere executable? I have done a couple of toy utilities in Janet, and knowing I can produce a single distributable binary makes it even more appealing.
As an aside, Cosmopolitan is news to me, but looks quite nifty.
Edit:maybe my comment was too short, but for me it is important to know what problem a new language solves (better). And I seriously think the landing page does not explain it well/at all. I mean like: D is C++ done right with garbage collection (and of course expand from there). Zig and Rust are safe languages and aim to replace C (with different strategies). And of course more than one sentence.
So if anybody knows what problem Janet lang solves, pls enlighten me.
Janet's biggest draw for me was it's PEG engine and API. That is still excellent.
But I'd say the biggest draw for me now is that Janet has a lot made a lot of choices I agree with.
It's language that boots up very quickly, makes for easy building of CLI tools, compiles to statically linked executables, has full compile-time metaprogramming (Lisp style), and can interface with C libraries very easily.
It doesn't solve any particular novel problem better outside of PEGs, but it makes a lot of the right decisions. And, being a Lisp-like, it also gives enough expressive power to help you build things your way, if you want.
Most of that probably appeals to folks who
a) have been programming for a while
b) don't hate parens
c) Are ok forging in untread territory
Janet isn't something I'd build a business on, not quite yet, but it has been a very, very satisfying hobby, and I've written a lot of small tools in it, more than Nim or Go during my times with either of those.
Mostly just time and testing coverage, and more packages for various things. Maybe another 10,000 man-hours? I don't know the exact numbers.
For context, I've found and/or helped fix bugs around multi-char string split, process termination on windows, and async IO on Windows. All things that forced me to pop the hood on the language, study relevant OS APIs, and generally yak shave, rather than focus on the task at hand. Which has been really edifying, but would have slowed me down if I was writing for a job.
In the process, I've written a few libraries of my own for things like string manipulation, data schemata, rendering html forms/tables based on a schema, and so on.
If you have people that are competent with C, then Janet atop that could work well, but by itself, it's still a long ways from having all of the things one might expect from Python/Ruby, let alone Java or .NET
The home page does happen to have everything necessary: it has a basic examples, a few blurbs, and a "use cases" explanation:
> Janet makes a good system scripting language, or a language to embed in other programs. Think Lua or Guile. Janet also can be used for rapid prototyping, dynamic systems, and other domains where dynamic languages shine.
I could see the sections reordered, but it's hard to really fault this home page, it's pretty terse yet quite complete.
The biggest issue I have with it is the first-time reader is hit by the community / contribution bits before even knowing what the language is about. A two-columns layout would probably be useful there. And while having a basic in-page repl is nice, improving the discoverability of the language through it (e.g. providing autocompletion and inline help) would be neat.
Do you have reading comprehension issues that you mistake examples for explanations and are blind to the actual explanations surrounding the examples?
> I mean if I want Lua, I use Lua.
That I know about Lua doesn't mean I want Lua. Hell, that I wanted lua in the past doesn't mean I'm closed to replacing it with something else. Given how well-known Lua is in the space, "think lua" is a rather good example.
Who knows? But could you point exactly to where it says why I should care about this language? Let's say I want to convince a cto to adopt it, what would be the edge one could/would gain? Maybe it has some exceptional libraries? Or GC pauses are deterministic, or whatever.
I mean this landing page is/should be their 2 minutes sales pitch.
It’s the most voted submission on HN right now. We gather here because we like this stuff.
And here you are wasting your time accusing us of being everything that’s wrong with tech.
The thing you fail to understand is that we aren’t in this for the money or the validation or the status.
We simply like fiddling with computers, languages, etc.
Computers were my hobby way before they were my job.
It's great that you like playing with computers, languages, etc. Nobody is minimizing that. But, many people who see a new computer language want to know what is unique about it.
It is completely valid to ask, "why should I use Janet (the language)?" Many people are familiar with or expert with many programming paradigms and have written their own DSLs or general purpose languages. Others are expert in fields that intersect with languages and want to know if there is specific applicability to their domain.
Seeing a new language that doesn't solve a unique problem or solve a problem in a novel way is often a complete non-starter. For that reason, many people expect a page on a new language to state the purpose of the language, even if the purpose is, "I wanted to play with writing a langauge." That's cool, too.
I'm pretty sure that is why several people have asked that question.
> It is completely valid to ask, "why should I use Janet (the language)?
Note that that isn't the question they started with (and would likely have provoked a different response). Perceived tone matters very much with a one-sentence question.
Zig is a nice improvement over C, but it is not safe.
There is work in progress (https://github.com/ziglang/zig/issues/2301), but from what I can tell, key details are still to be decided, including the classes of errors that will be covered, whether they will require runtime tracking, etc.
In my opinion, Zig should look into becoming UB-less -- listing undefined behavior instances like the C standard does or enabling safety only in some build modes is not enough.
Exactly! Zig is an improvement over C in many areas, but it's fundamentally still _not_ a memory safe language. It's comparable to a modern C/C++ project setup with valgrind and allocator checks by default. The comptime is nice, but C++17 and upwards have dramatically improved the "comp time" compiling in C++.
I've used it to make Freja, a text editor making coding GUIs and games fun for me again. Demo: https://youtu.be/KOBi805nxNc
When comparing to non-lisps
1. It has a real REPL, so you can do live coding (this is what makes me choose it over many languages at the same "level", js, lua, python, java). Honestly, this feature alone makes or breaks languages for me.
2. It is easy to interact with C (I found this hard in js, haven't tried the other)
Comparing to lisps (I've only properly tried guile & clojure)
1. Easy to build on windows / macos / linux (compared to guile which I didn't manage to build on windows)
2. Compared to clojure, just closer to the machine overall, in my case specifically OpenGL libs. I love Clojure but have had a hard time making client side apps with it. Done a bunch of CLJS stuff (e.g. card game https://animal-capital.surge.sh/), but many little things get annoying (e.g. can't open my editor from a browser error, can't `eval` etc. Doesn't quite have the live coding feel).
Thanks. Could you expand on the 'real repl', what do you mean exactly? For me live coding is also important, which I do for python in Ipython so I can run the scripts, access all the modules and do what I like in the repl; if I want persistent change I have to copy it in a script before closing the session though. Is this similiar to Janet or what am I missing?
I'm happy you asked! :) I think these terms are very vague, and I haven't found a good way to be more clear. For me a "real repl" includes:
1. Decent support from the language to do REPLy things
E.g. being able to change a function during runtime. Imagine an animation which is defined by perhaps: `(defn anim [time v] (* time v))`. Now you want to try something else, without having to recreate all state, so you just do `(defn anim [time v] (* time v v))` and hit Ctrl+L ("load file"). Oh, it seems I need to reset the animation, so I add some code to reset just the part of the state needed. Now I'm able to hit Ctrl+L and it'll run the new animation each time. The ability to do this ad-hoc anywhere in my code is so flow-inducing it's crazy. And I do this for games, web servers and browser GUIs. It's surprisingly general!
2. Editor support
The Ctrl+L I mentioned above is something I do in my editor to send code from my editor to the repl server. I haven't tried Ipython, but I'm guessing it might work similarly to node, where the client and server are kind of stuck together. With a "real repl", you generally use your editor as the client. Here's a video I've made that shows how this can look: https://youtu.be/Enumt6qxAgc?t=667
I know it's often possible to disconnect these (I've tried connecting my editor to the chrome debugger -- that's pretty cool!), but it doesn't seem to be in common use, which leads to...
3. Libraries supporting being run from REPLs
One not-so-uncommon problem is that e.g. a web server or game loop might block the REPL. This one is probably the hardest one to fix for existing languages and their libraries. There are often ways around this, like running on multiple threads, but that can lead to new problems. Even in clojure, I've had problems due to java libraries blocking (e.g. game lib LWJGL). It doesn't help that on macos all GUI related calls must be done on the main thread (so running LWJGL on one thread and repl on other breaks things). So far with janet I've managed to solve these issues easily thanks to the event loop (which iiuc works similar to js event loop).
---
I think the main thing to realize is that this way of developing leads to new possibilities of exploring software development. Suddenly you're able to experiment quicker, in a way that sometimes leads to typing speed being a bottleneck! :D It feels really cool, and I want to share this feeling of flow with as many as possible.
I agree. I am using Ipython from vscode, and I THINK I am doing it similar (cannot currently watch the video). I switched from a different editor, since the problem of the gui loop you mentioned (Ipython has gui loop running in the background, so you are non blocking, but not every editor plays along)
Ah, that's cool. I haven't heard of similar integrations with python, but I imagine it's possible to set up. :) Hope you're having fun with it!
If you get a chance to watch the videos it might give you some extra ideas on how to enhance your vscode + ipython experience, or maybe you can find issues with what I'm doing and tell me how to do it better. :D
I hope they never change the logo. It looks a lot like my mom, whose name was Janet. I'll probably end up trying out the language for that reason alone.
It's dead easy to get started. If you want to spend an hour playing with a "lisp" you're only a small download away. Clojure could learn a thing of two from this..
It's also not dogmatic. You can use mutable and immutable versions of the same data structure.
You're 2 clicks away from having a fully-featured clojure environment + an interactive clojure tutorial, thanks to Calva (vscode clojure plugin) running in the browser:
- click here[0]
- click on SSO provider
More information here[1]. Of course, it'd be better to just use the Calva plugin with VSCode. That's a bit more than 2 clicks, maybe about 5.
On another hand, I don't mean to say that it's easy to start programming on Clojure, merely that it's now easy to try it out. There's a steeper learning curve than python or JavaScript, specially on the tooling side.
> It's also not dogmatic. You can use mutable and immutable versions of the same data structure.
However from their description and the complexity promises it looks like the immutable collections are literally just the mutable ones without mutation ability (similar to Java's immutable* wrappers) which greatly limits their effective usefulness.
Persistent collections with structural sharing (b-trees, HAMT, RRB-vectors, …).
I can absolutely understand not using them if the implementation is intended to be simple or the systems it's running on is resource limited, but simply removing the mutation bits of mutable collections is quite limiting as it incurs large overhead when actually working with them (you have to copy the entire thing every time you want to update anything).
Unless the collections are always kept quite small: modern architectures are very good at dense arrays, so modern immutable data structures are trees of small-ish arrays (usually a small number of dozens, IIRC Clojure uses 32-wide nodes).
It is little weird, but it's also really fun to work with, if you're doing things that don't need to ship yesterday.
Working with Janet has deepened my knowledge of the Win32 APIs, for example, because it makes writing small bits of C for interacting with them about as easy as that can be.
I also like how it makes data structures and functions look the same in terms of access, and how it handles nil.
Janet is small, simple, efficient, and practical. For me it has nice syntax and sensible semantics. Great little package manager too. Very happy with and excited about Janet so far.
Thanks, although I should say that I searched for a few minutes about this Trojan and it seems Microsoft antivirus has been reporting it on other projects as well for years (since 2019 at least IIRC) and in the support forums the most upvoted answer was that the only way to stop it except for reporting every single new version as a false positive to Microsoft was to get a certificate and start signing the software.
I wonder if there is someone here from either Microsoft or Virustotal who could do something about it?
It's a valid problem, but I think the root cause has been a lot of complaining and noone reporting it through the right channels. They've responded to my ticket with a fix, a refresh on virustotal confirms zero detections now.
Why was Janet created? There must have been a purpose or niche that caused its inception. If the reason was, "I wanted to write a language," that's not enough to use it in certain situations.
I understand the why for embedded DSLs for things such as database queries, regex and the like but a general purpose embeddable language?
I wonder how many users these sort of languages have, aside from its creators and perhaps the company where it has been born. There are tons of embedded languages, many with libraries and all sort of utilities, why should someone invest themselves in such languages with all the risk it takes?
Problems such as: additional build steps, security, ecosystem, train employees and maintainers into new languages, additional maintenance barrier, etc
Seems like the prevailing opinion is that the website needs a “Why Janet?” blurb because I looked at this and thought, “Why would I ever use this over Racket?”.
For me, Janet seems more practical than Racket, or I at least got over the hump of it better. I like Janet's function-like data structure access as well, I don't know of another Lisp-like that does that.
In an interview with InfoWorld in April 2012, Karpinski said of the name "Julia": "There's no good reason, really. It just seemed like a pretty name."[
But it does not change the point.
People who created Ada believed that Ada Lovelice was the first programmer and named the language after her.
So it's not named after "somebody's girlfriend".
The fact that they were probably mistaken does not change this.
It she was brilliant anyway, even if not the first programmer.
What is with new programming languages with women's names? It seems a bit cringey to me, like the guy in my first-year cs classes who would name variables after his girlfriend.
I remember a HN post where someone talked about naming their daughter Lua. They liked the name when they first heard it, and being a programming language was just a nerdy bonus.
Telling their wife that it means 'moon' in Portuguese made it an easy sell.
I think it would be a great programming language if it arrives 5~10 years earlier. Highlights to me are: green thread, TCO, easy distribution, great interop with C, flexibility of choosing between imperative vs immutable data structures.
However, I just couldn't find a good use case for it. For embedded programming, I would always choose Lua if not using Zig/Rust directly. For low latency backend stuff, I can use Clojure or NodeJS, which are much more performant and mature (Janet's performance is roughly on the same level with Lua without JIT).
For general latency insensitive backend projects, there are just too many choices nowadays and Janet doesn't shine enough.
If it arrives 10 years ago with these feature sets, I would love it!