Wren: a small, fast, class-based concurrent scripting language
munificent.github.io
munificent.github.io
Wren looks equally fascinating; perhaps it could warrant a trail project of its own.
4000 semicolons
I've never seen that used as a way to measure code size, but it's perfect for Cish code. That alone made this worth the click. And the language itself looks like something I wish I could have designed. Good show."features: BSD license , small vm (~10K semicolons), ..."
https://web.archive.org/web/20150101035218/http://iolanguage...
I use perl and python for building little utilities. I like the regularity of python over perl, but if I could get a clean syntax and it ran 4x faster with Wren, that would be great. But if there isn't a regex facility, it is a non-starter.
"Wren is a scripting language. Wren is intended for embedding in applications. It has no dependencies, a small standard library, and an easy-to-use C API. It compiles cleanly as C99, C++98 or anything later."
• Link Wren (or Lua or a little scheme interpreter) into your larger system.
• Add some functions to Wren to access and manipulate the state of your larger system. (The sections on how to accomplish this are sadly marked as TODO in the Wren Reference manual.)
• Add a mechanism to your larger system to invoke Wren scripts.
Now instead of having to invent your own scripting system, or your own configuration system, or your own commands for every conceivable function a user wants, you can just expose the basics and let them build what they need.
Sometimes you might even use a scripting system where the main program is much smaller than the scripting system. For instance, I have a daemon which manages power allocation at a remote installation. It is written in go, and includes the functions to turn various systems on and off, measure current and voltage at different places, and the bare minimums of getting in and out of failsafe modes. All the rest of the decisions about what to turn on and off when and which system depends on which other system is all specified in a Lisp interpreter extension language and a config file. The end result is I wrote no lines of code to handle configuration, and extending the configuration involves no changes to the server. (Except if it needs a new function, like I had to add "time of sunrise" and "time of sunset" to the server since that was more Lisp than I was comfortable with.) Even in my simple configurations there is logic which would either be a nightmare or impossible in an Apache style config file but is simple in Lisp, even for a non-Lisp programmer like myself. (I chose the Lisp because it was a tiny implementation and written in Go so it was easy to build in. Not because I like it.)
---
There are a few scripting languages used for embedding in applications. Lua is the main one. TCL used to be. There’s also Guile, increasingly JavaScript, and some applications embed Python. I’m an ex-game developer, so when I think “scripting”, I tend to think “game scripting”.
Lua is nice: it’s small, simple, and fast. But—and I don’t mean this as a criticism—it’s also weird if you’re used to languages like C++ and Java. The syntax is different. The semantics, especially the object model are unusual. Anyone can get used to 1-based indexing, but things like metatables really show that objects were bolted onto Lua after the fact.
I think there’s room for a language as simple as Lua, but that feels natural to someone with an OOP background. Wren is my attempt at that.
---
Since Lua is rather tedious to use for me, I looked for alternatives with a C-like syntax. I found Squirrel and Wren but the last time I looked they lacked the tooling and mailing lists that Lua already has. It's a bit of a chicken-egg problem unfortunately.
Personally I don't mind if a language differs somewhat, but with Lua I constantly get errors because of basic things like braces, comments and comparisons.
You'd be pretty constrained by what concepts of "object" to support, though.
Yup, Wren still has a long ways to go in terms of being a mature ecosystem, but it's getting there slowly. It would be moving faster, honestly, if I put more time into it, but there are only so many hours in the day.
That's up to the program embedding them -- the idea is that you're the one implementing the communication and synchronization in the embedding program, rather than in Wren itself.
For small cli apps, being able to write them in a pleasant to use language like Wren would be a big win.
looking forward to your jit. have a look at potion, it's really simple and fast.
In general, the language does not matter much - the ecosystem does and it includes libraries, integrations, etc.
Duktape [0] in a similar position.
[0]: http://duktape.org/
The point is that developers should express themselves for a general audience. There is already sufficient macho separation between developers and the real world that we've just stepped into The Matrix.
The point here is we should aim for clarity and explanations instead of reappropriating words and meanings, often for truly random reasons.
Yes, I know what _fibers_ allude to in this context. I didn't like it when it was first used when I was younger either.
Too many exclusive high horses here, I think.