5 ms·
Quoting myself from my own FAQ[1] feels a little weird, but here you go: --- There are a few scripting languages used for embedding in applications. Lua is th
by munificent 11y ago
Quoting myself from my own FAQ[1] feels a little weird, but here you go:
---
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.
---
[1]: http://wren.io/qa.html#why-did-you-create-wren http://wren.io/qa.html#why-did-you-create-wren
- commentzorro 11y agoWhat language bindings are available? Golang by chance?
- untothebreach 11y agoAbout a year ago I made Rust bindings, but they are out-of-date now, as I kind of stopped participating in the wren community (not their fault, I stopped participating in a lot of communities due to some happenings in my personal life). I will have some more time coming up here soon, and hope to get back into it.
- munificent 11y agoNo Go yet, but a couple: https://github.com/munificent/wren/wiki/Language-Bindings https://github.com/munificent/wren/wiki/Language-Bindings
- emsy 11y agoI used to have a program with an embedded Lua interpreter where I sometimes needed to switch back and forth between C++ and Lua. It's insane. Arrays don't start at zero, you create blocks with keywords and then there are some minor annoyances like != being ~= or the lack of a ternary operator. Where Lua really shines though is the binding api. It's really easy to use when you have to do something by hand. The documentation is great and you have a selection of binding tools. You can even create classes with overridable virtual methods. 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.
- eropple 11y agoAn option that might be worth looking at is AngelScript, which I think minimizes the context switch between C++ and the scripting layer really nicely.
- emsy 11y agoI totally forgot about AngelScript. It really has the lowest context switching overhead, but you get to keep the verbose C++ syntax in return, which is a trade-off. 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.
- Pxtl 11y agoI wonder of a language-agnostic computing platform could be developed based on a Lua-like securely-embedded system. That is, something like the JVM, but the client code can only access the things that are explicitly provided to it by the host environment. You'd be pretty constrained by what concepts of "object" to support, though.
- pygy_ 11y agoFor Thimbleweed Park, Ron Gilbert considered Lua but found it too "goofy" syntactically, and ended up using Squirrel. https://blog.thimbleweedpark.com/engine https://blog.thimbleweedpark.com/engine
- emsy 11y agoAnother thing I forgot to mention was tooling. With Lua you can already get debuggers, libraries and IDEs that other languages still lack.
- munificent 11y ago> I found Squirrel and Wren but the last time I looked they lacked the tooling and mailing lists that Lua already has. 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.