7 ms·
Wren: a small, fast, class-based concurrent scripting language
- realworldview 10y agofibers? sounds like a duck named quacky.
- ob 10y agoI assume they mean this: https://en.wikipedia.org/wiki/Fiber_(computer_science) https://en.wikipedia.org/wiki/Fiber_(computer_science)
- dang 10y agoPlease don't post unsubstantive comments to HN.
- nilkn 10y agoThe term is being used pretty accurately here. It's a cooperatively scheduled thread of execution (as opposed to preemptive scheduling, used in many operating systems and the Erlang VM).
- realworldview 10y agoSo much anger. 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.
- untothebreach 10y agoWren is great, I participated in the community for a while but then got on to different things. Glad to see it is still going strong.
- amflare 10y agoLooks interesting, but I can't figure out where/for what it would be used. Am I missing something obvious?
- untothebreach 10y agoIt looks like the last bullet point on the page, so I'm not surprised that you missed it. They could definitely put this farther up the page: "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." http://munificent.github.io/wren/ http://munificent.github.io/wren/
- jws 10y agoI would use it as an extension language for a larger system. These commonly are used in games, databases, web servers, and text editors. You might: • 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.)
- Ameo 10y agoThe fibers remind me of Elixir's processes. Elixir fascinated me at first, but I really didn't get into the groove of it after trying it out on a project. Wren looks equally fascinating; perhaps it could warrant a trail project of its own.
- nilkn 10y agoAre Wren fibers automatically distributed across available CPU cores or is it all single-threaded?
- munificent 10y agoSingle-threaded. The Wren VM itself is completely self-contained and has no global state. So, if you wanted to, you could host multiple VMs simultaneously, one for each thread, to get actual concurrency. You'd have to do the marshalling to move values from one to the other to get sharing or communication working, though.
- duaneb 10y agoIf the VMs are self-contained, what mechanism would they use to communicate? id be ok to use marshaling if the marshaling itself is the dominating cost of communication.
- ori_b 10y ago> what mechanism would they use to communicate? 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.
- munificent 10y agoExactly right.
- duaneb 10y agoI would imagine some base shared memory copy on write queue system would help here immensely.
- deleted 10y ago[deleted]
- nikolay 10y agoA cute little language, but without the support of existing libraries, it can't gain mass adoption. It will take years to catch up with LuaJIT, and its vibrant ecosystem.
- ketralnis 10y agoIsn't that true of every language ever? Surely Lua was in that position when it was young. That just doesn't sound like a reasonable objection to anything that's young
- nikolay 10y agoOf course, but how many years did it take for Lua to get there? Without piggybacking off existing libraries, prepare for a very long journey! 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/ http://duktape.org/
- Touche 10y agoI wish languages in this space would make it easier to create statically linked executables. With Lua you can do it yourself using squishy and a small main.c program, but it would be nice of the compiler just did it all for you. For small cli apps, being able to write them in a pleasant to use language like Wren would be a big win.
- ww520 10y agoWhat is the performance like? Comparable to V8 javascript? Or maybe even comparable to LuaJIT?
- andrewflnr 10y agoOnly comparable to LuaJIT with the jit off, because "Mike Pall is a robot from the future.": http://munificent.github.io/wren/performance.html http://munificent.github.io/wren/performance.html
- ww520 10y agoWren's performance is pretty impressive!
- andrewflnr 10y ago4000 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.
- emmanueloga_ 10y agoProbably a homage to IO: "features: BSD license , small vm (~10K semicolons), ..." https://web.archive.org/web/20150101035218/http://iolanguage.org/ https://web.archive.org/web/20150101035218/http://iolanguage...
- tasty_freeze 10y agoI've looked through the wren.io website, including the module documentation. As a scripting language, I would expect Wren to have decent regex support, but I find nothing there. Did I overlook it? 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.
- Kelet 10y agoHmm – I'm working on some Windows API manipulations to provide a framework to make `macro scripts` (similar to AutHotKey or AutoIt), and in a few weeks I'll be looking to implement a scripting language. I've checked out LuaJIT, Lua 5.3, Lua w/Terra, AngelCode, Python, et al. and they all seem to have their faults. I actually need a language that supports both proper threading and co-routines, to respond to user-based key hooking (and good stuff like timers). This seems like it may be a good candidate, I don't mind contributing either. Bookmarked.
- rurban 10y agoBob: so no workstealing with native threads anymore, just tiny fibers? looking forward to your jit. have a look at potion, it's really simple and fast.