[HN Gopher] My Janet Story
       ___________________________________________________________________
        
       My Janet Story
        
       Author : yumaikas
       Score  : 67 points
       Date   : 2021-09-24 19:45 UTC (1 days ago)
        
 (HTM) web link (junglecoder.com)
 (TXT) w3m dump (junglecoder.com)
        
       | newaccount2021 wrote:
       | janet is a lot like guile, chicken scheme in that the authors go
       | as far as building out support for the core language, but little
       | else. is lisp/scheme so cool that I want to use a language with
       | no libraries?
       | 
       | yeah I know, racket, but in the end you'll just end up writing
       | python with more parentheses
        
       | sulam wrote:
       | I really like the neologism of "investingating".
        
         | yumaikas wrote:
         | Oops, that was not an intentional spelling.
        
           | sulam wrote:
           | I figured, but I still like it! :)
        
       | robbiet480 wrote:
       | I was hoping this story was going to be about flying Janet
       | Airlines, the secret government airline that flies employees into
       | Groom Lake (Area 51) and other secret and semi-secret
       | installations in the southwest
       | https://en.wikipedia.org/wiki/Janet_(airline)
       | 
       | Still a great article though
        
       | cyber_kinetist wrote:
       | I initially thought Janet was a language intended more for
       | embedding inside C applications than general usage though. (If
       | you're intending to use the language for general purposes,
       | there's already too many contenders like Clojure and it probably
       | has all the libraries you need for all sorts of things like
       | webdev.) But given that there's already a general-purpose package
       | manager developed for Janet, I guess the dev is pivoting towards
       | a different direction...
       | 
       | I'm still curious about how good the embedding story is (ex. for
       | game scripting or as a configuration language), compared to other
       | scripting languages like Lua/Squirrel/Wren. (Runtime memory
       | usage, GC overhead, how easy and performant it is to create C
       | bindings, etc...)
        
         | petre wrote:
         | You forgot about GNU Guile which is an Scheme implementation
         | designed specifically for embedding into applications.
        
           | aasonk wrote:
           | I think guile has moved away from embedding, its most major
           | use is probably in guix where much of the logic is directly
           | implemented in guile with efforts (last i checked, a while
           | ago though) to remove the remaining C++ and replace it with
           | guile too.
           | 
           | It even has a JIT these days too
        
         | yumaikas wrote:
         | My impression of Janet is that it's threading a needle there.
         | 
         | The core is still heavily meant for embedding. It's not _as_
         | light as Lua, but there 's an amalgamation .c and .h, you can
         | strip out everything that depends on an OS underneath, and so
         | on.
         | 
         | That being said, a lot of folks that use Janet and are in the
         | gitter/matrix server are currently focused on aspects of web
         | dev, myself included. Lisp, as always, enables a lot of
         | expressive power there that enables building your own pieces of
         | the web stack, for example.
         | 
         | C bindings are relatively easy, and use the same interface that
         | is used to build the standard library, so performance doesn't
         | really take a hit from the interop code.
         | 
         | I can't speak to the GC, other than to say that it hasn't been
         | an issue for me yet.
        
         | yumaikas wrote:
         | The other really pleasant aspect of Janet is that it easily
         | enables build fat-image executables. Asset packing is as easy
         | as a top-level                   (def asset (slurp "file.txt"))
         | 
         | This makes it a lot more at home on Windows than Python or Ruby
         | on that respect, IME.
        
         | shadilay wrote:
         | I initially thought it was Janet Airlines.
         | https://en.wikipedia.org/wiki/Janet_(airline)
        
       | didibus wrote:
       | If you like Janet, you'd probably like Clojure a lot as well.
       | 
       | If you want to take on web apps, backend services, machine
       | learning and data-science, desktop GUI applications, mobile
       | applications and/or distributed computing use cases, it could be
       | a good choice where Janet lacks the chops, but Clojure offer a
       | very similar feel while enabling those use cases.
       | 
       | For scripting, CLI, and embedding with a C interface, Janet
       | rocks.
        
         | yumaikas wrote:
         | Clojure was something I tried once or twice, but couldn't quite
         | get into, at least back when I tried it before.
         | 
         | These days, I might be better able to pick it up, having cut my
         | REPL teeth on Janet.
        
           | didibus wrote:
           | There's definitely a higher barrier to entry to Clojure.
           | 
           | There's more layers to understand, because it is hosted over
           | existing runtimes, instead of being self-contained like
           | Janet.
           | 
           | For that I would recommend starting out with Babashka
           | https://babashka.org/ it'll take some of that edge off,
           | because it is a self-contained interpreted Clojure. It's a
           | good way to start where you can get straight to writing code
           | and learning the language itself, and not having to learn
           | about how it is all scaffolded and bootstrapped over a JVM,
           | CLR or JS runtime.
           | 
           | Clojure also forces you almost exclusively into the
           | functional programming style. Doing imperative things in it
           | is ackward. So if you tend to rely mostly on Janet's
           | imperative constructs, this might be a bit of a shock.
           | 
           | Don't really have a trick for this one, just got to learn and
           | practice FP to get familiar with it. Also, it depends a bit
           | what you're doing, a lot of coding questions and small
           | exercises tend to be simpler to implement imperatively,
           | because they're either designed to be so, or are very focused
           | on raw performance. FP will show its worth when writing
           | larger programs in my opinion, where long term productivity,
           | extendability, modularity, maintainability, and
           | robustness/correctness become your biggest concerns. So in
           | the small, it can often seem like a more convoluted way to do
           | things, though for certain problems it also can land itself
           | really well.
        
             | yumaikas wrote:
             | One thing I find funny/curious: Does clojure not have a
             | destructuring match in it's standard library? Most people
             | that I've seen move from Clojure to Janet seem to avoid
             | using that.
             | 
             | For me, the two types of programs I tend to use to exercise
             | an language early on are small CLI programs that help me
             | free up mental space, and web apps. Clojure, outside of
             | babashka seems ill-suited to the first (and I've not
             | figured out how to get the CLR clojure up and running).
             | 
             | And when I last tried to do web apps with Clojure, it
             | seemed like everything relied on a lot of self-assmebly,
             | and didn't map cleanly to ways I knew how to web apps at
             | the time from Go, C#,or Erlang. I dunno what the situation
             | is there these days.
             | 
             | For Janet, I did lean into the more imperative constructs
             | early on.
        
         | jb1991 wrote:
         | > desktop GUI applications
         | 
         | With the exception of Electron apps, this is a bit of an
         | exaggeration. There are far better choices in that area than
         | Clojure.
        
           | didibus wrote:
           | That are also going to be close to Janet in look and feel?
           | Please let me know, I'm interested to try.
        
             | lc9er wrote:
             | Racket has a cross-platform GUI library. It's what drives
             | the DrRacket editor.
        
         | adenozine wrote:
         | I've been trying to get into clojure but getting a big
         | stacktrace of JVM junk whenever I make a mistake is
         | frustrating.
        
           | diggan wrote:
           | As someone who learned Clojure before I picked up any sort of
           | Java knowledge, the "big stacktraces from hell/JVM" problem
           | seems kind of over-pushed, it's not as bad as people make it
           | out to be.
           | 
           | Yes, the stack traces are long, but if you actually follow
           | them, they'll show you what your problem is, not sure what
           | else you can wish from a stack trace. I'd rather have too
           | long stack traces with all the details than just a error
           | message without anything to go by.
           | 
           | And since you most likely get your stack trace from when
           | evaluating just a snippet of code with some exception, the
           | stack traces tend to not be as big as for other programming
           | projects (like Java, JavaScript, Golang and else) either
           | where you need to run the entire program in order to
           | reproduce some issue.
        
             | adenozine wrote:
             | I guess what bothers me is that if I'm going out of my way
             | to try and deal with Clojure, I don't _want_ the
             | information with all of the JVM magic (tm) underneath, I
             | just want to know why my Clojure is wrong. Come to think of
             | it, I don 't think I've ever really used a hosted language
             | of any kind before, for serious work, so I guess I've just
             | never had to be aware of this.
             | 
             | On a laptop with only a single screen of real estate, even
             | as orderly as the trace might be, it's a distinct hassle to
             | scroll and walk it all the way back to a method argument
             | problem somewhere, and equally frustrating to think about
             | because I'm using a functional language to try and avoid
             | thinking about classes and methods and whatnot.
             | 
             | Maybe I'm just expecting Clojure to taste like Scheme, and
             | I'm probably wrong.
        
       | chris_st wrote:
       | > _(And yes, despite what the Common Lisp community has to say,
       | Janet is a lisp, even if it's not a Lisp)_
       | 
       | I love this and understand both the sentiment expressed and (as a
       | recovering member of the Cult Of Lisp) the reason why it was
       | said.
        
         | didibus wrote:
         | I've tried to check why it was said by the CL folks, but I'm
         | only seeing that they feel it's not a Lisp because it lacks
         | cons cells, which I find a very weak argument, since cons cells
         | are an implementation detail in my mind.
         | 
         | The syntax and semantics are clearly similar to that of Lisps
         | before it, and so is the feature set enabled by that very same
         | syntax and the very same semantics. In that sense if Janet had
         | to be the dialect of something else, I don't see what else but
         | being a dialect of Lisp it could be.
         | 
         | And I don't think Janet is different enough in syntax and
         | semantics to be given its own new family of language.
         | 
         | Anyways, those debate are kind of for fun and games, cause it
         | doesn't really matter, but I think the description you could
         | give to someone else who's asking: What's it like? And if you
         | say, it's a bit like programming in any other Lisp, well you'd
         | be giving them a pretty good idea of what it was like, unless
         | they'd never programmed in any other Lisp either, then you're
         | going to struggle, because there's not a whole lot like Lisp.
        
           | zdragnar wrote:
           | It's all in the name- lisp : LISt Processing.
           | 
           | That said, I am not such a purist as to be bothered by it,
           | and janet has a special place in my heart right along with
           | chicken, racket, clojure and CL.
        
             | didibus wrote:
             | What's a list though? Why should it refer specifically to
             | the concrete implementation?
             | 
             | Lists in a conceptual sense are an ordered collection of
             | heterogeneous elements with nestings.
             | 
             | In that sense, code in Janet is very much represented as
             | such and processed as such. Which in my mind makes it a
             | LISt Processing language :p
        
               | lispm wrote:
               | Lisp is does not stand for generic 'List Processing', but
               | for 'List Processor' -> a specific formalism to process
               | lists.
               | 
               | There is a specific minimal core of Lisp, which consists
               | of a certain minimal set of data structures, operations
               | and an evaluation mechanism.
               | 
               | An early version is described here:
               | 
               | https://dspace.mit.edu/bitstream/handle/1721.1/6096/AIM-0
               | 08....
               | 
               | Another one is described here:
               | 
               | https://www.ee.ryerson.ca/~elf/pub/misc/micromanualLISP.p
               | df
        
               | yumaikas wrote:
               | That is true, but to engage in a bit of semiotics: those
               | cores are hardly the most appealing part of Lisp for most
               | of the uses cases it's found. It certainly was one way to
               | enable the interactivity and homoiconicty and
               | metacircularity, but, as Clojure and Janet demonstrate,
               | there are a lot of other aspects of Lisp that have value.
               | And while one could (and some have, IIRC) built a Lisp on
               | those minimal data structures that doesn't have parens,
               | most people associate Lips with them being in the strange
               | place.
               | 
               | Cons/car/cdr are far less important, IMO, than eval.
               | 
               | Read, on the other hand, is also technically missing from
               | Janet, and I personally don't mind a great deal, but I
               | could see that being argued.
        
               | [deleted]
        
               | lispm wrote:
               | One of the inventions of McCarthy (and team) was that
               | EVAL can be defined in the core language itself (!) and
               | thus serve as a relatively simple model of computation.
               | Thus the particular EVAL is important, not that source
               | code can be executed at runtime by some api call to
               | execute code.
               | 
               | That's part of the core of the language.
               | 
               | Sure: Many other aspects from Lisp can be found also in
               | Lisp-derived languages and other languages. Like all or
               | some of runtime code loading, symbolic expressions, using
               | symbolic expressions to encode source code, saving and
               | starting heap images, garbage collection, managed memory,
               | source level interpreters/debuggers, self-hosted
               | compilers, read-eval-print-loops, macros, fexprs,
               | integrated interactive development environments, ...
        
         | yumaikas wrote:
         | What's funny is that I came up with a half-decent acronym this
         | morning: PAST.
         | 
         | Paren AST languages.
         | 
         | But this article has been sitting in a draft for the better
         | part of a month, lol.
        
       | nerdponx wrote:
       | What's the package management story with Janet? I've had my eye
       | on it, but I'm not willing to manually download a bunch of source
       | repos and mess around with configuration in order to use other
       | people's code. Life is too short for that stuff.
        
         | yumaikas wrote:
         | JPM is a tool distributed alongside Janet that will download
         | deps for you with `jpm deps`.
        
         | akkartik wrote:
         | What languages do you use, and how is that heuristic going for
         | you? I find package managers help for some time after they're
         | introduced, and then life sucks once again as they enable
         | people to add lots of dependencies. It's kinda like how
         | building more roads never seems to fully eliminate traffic
         | jams.
        
       ___________________________________________________________________
       (page generated 2021-09-25 23:01 UTC)