5 ms·
The page doesn't do much to tell me why I would choose to use this over something I've heard of before.
by emodendroket 12y ago
The page doesn't do much to tell me why I would choose to use this over something I've heard of before.
- riffraff 12y agothe language has been around for quite a few years, but "Squirrel is a high level imperative, object-oriented programming language, designed to be a light-weight scripting language that fits in the size, memory bandwidth, and real-time requirements of applications like video games." could tell you it's smaller than ruby/python/php, and designed to be OO compared to Lua or others. There is also a list of features, I don't think the authors of the page should have a list of "we are better than X" for every value of X.
- emodendroket 12y agoNo, but my point was more that the very bare samples on the page don't tell me much about what's interesting about Squirrel or why I would use it. Just how to declare a class.
- throwawaymylife 12y agoSquirrel is roughly similar (in the grand scheme of things) to Lua and JavaScript, with more of a (C++-style) OO flavor. Its main selling point is that it uses reference counting instead of a tracing garbage collector for automatic memory management. With a reference counted language, you pay a small but predictable cost every time something goes out of scope, whereas tracing garbage collectors coalesce all of these small costs into one big collection cycle run every few milliseconds. The tradeoff is that while garbage collected languages provide better throughput (due to cache effects, heap fragmentation, etc) for batch processing jobs, reference counted ones are much more suitable for realtime and soft realtime applications that would much rather take a constant factor hit to throughput if it eliminates the danger of a multi-millisecond GC scan causing the application to miss a deadline. As such, Squirrel enjoys some popularity as (and was indeed created to serve as, by an engineer that had grown frustrated with the experience of embedding Lua in FarCry) a scripting language for video games, being most notably used in some of Valve's newer games, like Left 4 Dead 2, Portal 2, and CS:GO. The rest of the engine code usually dwarves the performance impact of "scripts" in most games, but GC scans can still cause games embedding other scripting languages to miss a frame presentation deadline, resulting in either a nasty tear or a completely missed frame. There are ways that tracing garbage collected languages can attempt to combat this (like incremental GCs), but some engine programmers have decided to accept the throughput cost for the peace of mind that reference counting provides. EDIT: I had more but HN is silently ignoring some of my edits for some reason. Is there a post length restriction for new users, or have I tripped some kind of bizarre content filter?
- emodendroket 12y agoI see. That's interesting; I think the page could do more to explain it.
- throwawaymylife 12y agoI agree. With embedded "scripting" languages, you have to differentiate between two kinds of users that don't always (or even usually) overlap: the people writing the scripts (who may or may not even consider themselves to be programmers), and the engine programmers embedding the language in their game engine or other application. IMHO, the current homepage isn't really doing a great job of appealing to either group, and it'd be much more effective if it directly explained the advantages of its implementation to the engine dev crowd; that might alienate the script programmers a bit, but thinking about AAA game development, they're almost never the ones that get to pick the language anyway.
- nanofortnight 12y agoIt's primary advantage over Lua is definitely it's better realtime guarantees.
- codexon 12y agoReference counting is not a complete GC solution, it does not collect circular references which happen quite often. That is why python will occasionally run a mark and sweep GC even though it says it uses reference counting.
- 1morethrowaway 12y agoIt's good enough by itself if you tell programmers not to create circular references and explicitly use weak references if they really need to. That opens you up to memory leaks from accidental circular references, of course, but again, it's a worthwhile tradeoff for many projects.
- codexon 12y ago