[HN Gopher] Wren: A classy little scripting language
       ___________________________________________________________________
        
       Wren: A classy little scripting language
        
       Author : Lyngbakr
       Score  : 87 points
       Date   : 2025-10-22 16:21 UTC (4 days ago)
        
 (HTM) web link (wren.io)
 (TXT) w3m dump (wren.io)
        
       | gnabgib wrote:
       | Popular in 2022 (301 points, 130 comments)
       | https://news.ycombinator.com/item?id=32631553
       | 
       | 2020 (122 points, 54 comments)
       | https://news.ycombinator.com/item?id=23660464
        
       | apitman wrote:
       | I was working on a custom runtime for minimal wasm apps recently.
       | I didn't want to have to write all apps in C or Rust, so I went
       | looking for tiny scripting languages. Lua is pretty small, but I
       | wasn't able to get it to compile to wasm IIRC due to POSIX
       | dependencies. This turned out to be quite easy with Wren[0].
       | 
       | [0]: https://github.com/wren-lang/wren/issues/1199
        
         | MattJ100 wrote:
         | That's unusual that you struggled to build Lua. Lua is
         | primarily C89, and used on non-POSIX microcontrollers for
         | example. There are some optional bits of the standard library
         | you would have to leave out - module loading uses dlopen().
         | This is done simply by defining the right feature macros for
         | your target environment:
         | https://www.lua.org/source/5.4/luaconf.h.html
         | 
         | You may also be interested in this project:
         | https://github.com/fengari-lua/fengari
        
         | Imustaskforhelp wrote:
         | Wow, I really went into a rabbithole after opening up your
         | hackernews profile seeing indiebits and remembering my time
         | scouring your github awesome tunneling page and then I went to
         | discourse forum and somehow found new resources about self
         | hosting and saw yunohost and others as well all in matter of
         | minutes.
         | 
         | Thank you for your service in self-hosting. I had so much fun
         | trying to break nats with awesome tunneling projects and I even
         | created my own but it actually requires a custom patch of ssh
         | with pinggy to work without nat (let me know if you are
         | interested, as I had discovered this a year ago but I just am a
         | little lazy haha)
         | 
         | I have created only one issue on the awesome tunneling but let
         | me tell you some of them don't work in nat's/broke
         | 
         | https://freedomhascost.bearblog.dev/
         | 
         | Just created the bearblog post, not sure why the name but just
         | wanted to say thank you and wanted to share any knowledge I
         | have in the process as well to strengthen the hacking/tinkering
         | community. Thanks once again
         | 
         | Also its just a bit of a coincidence that we are talking on a
         | wren page as I was literally reading about wren once again and
         | playing with it just yesterday and joined their discord server
         | yesterday or day before that to tinker with it. Wren is really
         | elegant and I feel like I want to write more software which
         | integrates it instead of lua as a thought experiment as well
         | and wasm seems a cool idea too in that regards.
        
       | sandbags wrote:
       | I would love to replace JS as the scripting language in one of my
       | native macOS apps and I wonder if Wren would be suitable.
       | 
       | The two biggest questions I'd have are:
       | 
       | 1) how easy it would be to bridge Obj-C objects to Wren-space and
       | vice versa (a big win of using JavascriptCore) 2) how easy would
       | it be to implement script debugging? This is not exactly a
       | strength of Javascript core but it is at least possible by
       | connecting the Safari web inspector.
       | 
       | There's lots I don't like about JS and JSCore but i've yet to
       | find a better alternative.
        
       | reactordev wrote:
       | This looks super cool up until I got to the point where it says
       | inherited classes don't share the same metatable. Meaning if you
       | want to provide the same method on your inherited classes, you
       | have to write the same thing and do a _super.method()_ which
       | means a lot of work if you're into OO design so I'm not sure if
       | classes is the right construct here. Am I wrong or did I miss
       | something from the documentation? Other than that it looks like
       | fun to use as an embedded scripting engine.
        
         | nick__m wrote:
         | you probably meant metaclass and according to the doc classes
         | inheritance don't have surprising behaviors. And about the
         | metaclass not being inherited here are the implication:
         | ...In more prosaic terms, this means that static methods are
         | not inherited.
        
       | plainOldText wrote:
       | Reminder the creator of Wren wrote the awesome _Crafting
       | Interpreters_ book [0].
       | 
       | [0] https://craftinginterpreters.com/
        
         | l9o wrote:
         | This is awesome. Thank you for sharing. I have been working on
         | a small interpreted language for shell scripts with lots of
         | help from Claude Code. The main idea is to automatically
         | generate the cli interface for the scripts based on function
         | definitions. However, I'm far from a programming languages
         | expert, so I've been a bit hesitant to share my work. Going to
         | give this book a read this week to see how far I am. Thank you!
        
           | manveru wrote:
           | Take a look at how Nushell does this, it's quite neat: https:
           | //www.nushell.sh/book/custom_commands.html#documenting...
        
             | l9o wrote:
             | That's excellent. Somewhat similar to the syntax I went
             | with, but most likely much better implemented. I'm going to
             | give it a go. Thank you!
        
         | mhaberl wrote:
         | and he wrote Game Programming Patterns [0]
         | 
         | [0] https://gameprogrammingpatterns.com/
        
         | ronbenton wrote:
         | Knowing this is the author makes me 1000% more interested in
         | Wren. What a great book!
        
         | thw_9a83c wrote:
         | It is an excellent book and one of the canonical texts on the
         | subject. My only suggestion for the "Lox" language would be to
         | include an implementation of arrays, and preferably also
         | hash/dict arrays. Other than that, the book contains everything
         | you need to know about implementing a programming language.
        
           | smnplk wrote:
           | I wish he would have used C for everything. You need to buyin
           | into Java's whole OOP thing, which I am not a fan of.
        
             | nine_k wrote:
             | Wren, the topic of the post, is positioned as a descendant
             | of Smalltalk, the most OOP language of them all. The author
             | clearly finds the OOP paradigm important.
        
         | alberth wrote:
         | Is Bob still involved (in Wren)?
         | 
         | I thought his focus was Dart these days given being employed by
         | Google.
        
       | bragr wrote:
       | This seems like a nice alternative to Lua. I've always liked
       | embedding Lua in other software, but I confess I have never
       | really liked Lua as a language.
        
         | versteegen wrote:
         | I really like the sound of Wren, but you may also want to look
         | into Squirrel, it's basically Lua re-imagined/reimplemented but
         | without all the Lua quirks and with C-style syntax (but it
         | still has optional lua-style prototypes, which means it ends up
         | very similar to Javascript). Its embedding API is largely a
         | copy of Lua's. There is also an active fork called Quirrel that
         | makes the language more like Python.
         | 
         | There are loads of scripting languages but very few of them
         | have an embedding API as powerful as Lua or Squirrel's. (My
         | benchmarks: what's the overhead of a userdata pointer? Is there
         | a proper debug API? Can you suspend a co-routine from inside a
         | called C function? Very few languages even have coroutines.)
         | Last I looked at it years ago, Wren was one of the best. Of
         | course, the most featureful embedding API of all belongs to
         | LuaJIT.
        
       | tromp wrote:
       | Wren ties with Phix for most tasks done on Rosetta Code [1].
       | 
       | [1]
       | https://rosettacode.org/wiki/Rosetta_Code/Rank_languages_by_...
        
       | davidw wrote:
       | Looks very nice! Erlang's concurrency isn't 'cooperative' though
       | - it has a scheduler, so even a runaway process won't bog down
       | the whole system.
        
       | gabrielsroka wrote:
       | 2016
        
       | ksymph wrote:
       | Wren is the primary scripting language for the Luxe engine,
       | currently in development: https://luxeengine.com/
        
       ___________________________________________________________________
       (page generated 2025-10-26 23:00 UTC)