[HN Gopher] Ketos: Lisp dialect scripting and extension language...
       ___________________________________________________________________
        
       Ketos: Lisp dialect scripting and extension language for Rust
       programs
        
       Author : lnyan
       Score  : 58 points
       Date   : 2021-09-22 14:08 UTC (8 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | brabel wrote:
       | GNU Guile was designed for embedding and is very light... maybe
       | just use that instead?
        
         | m0th87 wrote:
         | I wrote up some rust low-level bindings for guile [1]. The
         | problem is that Guile liberally uses setjmp/longjmp, which
         | breaks rust destructors. It might be possible to fix this by
         | wrapping every call the way rlua does [2], but I'm not familiar
         | enough with Guile to know.
         | 
         | 1: https://github.com/ysimonson/guile-sys
         | 
         | 2: https://github.com/amethyst/rlua/issues/21
        
         | outworlder wrote:
         | Or Chicken Scheme, or Gambit Scheme, which can be used
         | standalone, embedded, or as glue with their great C interop.
         | 
         | I love seeing Scheme(or Lisp) implementations, they are kind of
         | a Rosetta Stone of programming languages. We can study them and
         | learn the target languages.
         | 
         | They seldom become implementations in widespread usage on their
         | own, though.
        
       | ibraheemdev wrote:
       | Cool language, it'd be great if there was a code block example in
       | the README.
        
       | m0th87 wrote:
       | I messed around with and contributed to this project a bit. The
       | biggest challenge I saw in day to day usage was that line numbers
       | aren't included in error messages:
       | https://github.com/murarth/ketos/issues/11
        
       | vindarel wrote:
       | If you're seeking performance, stick to Common Lisp?
       | https://renato.athaydes.com/posts/how-to-write-slow-rust-cod...
       | they sweat to great lengths to beat the _non-optimized_ original
       | Lisp program^^ (for ML-style type checking, check out the newly
       | released Coalton library) TLDR; when talking Lisp, CL has still
       | much to show.
        
         | outworlder wrote:
         | Common Lisp is wonderful. It was really ahead of its time -
         | and, in some cases, still is. We would also have avoided many
         | cycles of markup and configuration languages.
         | 
         | That said, having a small Lisp or Scheme script in a Rust (or
         | C) program can be helpful. Although I would honestly look into
         | just adding Chicken, Gambit scheme or Guile at this point.
         | 
         | Scheme and all Lisp likes are deceptively simple - you can
         | implement an interpreter in a weekend. Then spend a lifetime
         | trying to make it efficient.
        
           | fouric wrote:
           | Exactly. Python : Lua :: CL : Guile. Python and CL are much
           | more capable general-purpose languages than Lua and Guile,
           | but the latter are better for embedding into larger programs,
           | partially _because_ of their limited scope and features
           | (which, among other things, simplify the amount of work that
           | the embedding program has to do, as well as the FFI between
           | the two).
        
       | gleenn wrote:
       | Looks close to Scheme to me. Very cool. Anyone know how much of
       | the Rust memory safety you're going to lose using this? It looks
       | relatively strict a la the immutable local variables but are they
       | just going to garbage collect those somehow? Or is this done in a
       | way that the borrow checker remains happy when interopting with
       | normal Rust code?
        
         | Jweb_Guru wrote:
         | The data look fully immutable, which means no cycles, so I'd
         | bet on some form of reference counting being used for garbage
         | collection (though I haven't looked closely). As for memory
         | safety, there are just five well-encapsulated uses of unsafe in
         | the whole repository; you can inspect them and decide for
         | yourself :)
        
       ___________________________________________________________________
       (page generated 2021-09-22 23:02 UTC)