Squirrel – A high-level, light-weight scripting language
squirrel-lang.org
squirrel-lang.org
https://computerscomputing.wordpress.com/2013/02/18/lua-and-...
My first thought is "Squirrel doesn't have Mike Pall" but that isn't quite fair to the author or the intentions of the language.
If anyone is interested, the development blog is full of examples of how it is being used in the game: http://blog.thimbleweedpark.com/scrolling_rooms http://blog.thimbleweedpark.com/switching_and_inventory
That being said I agree with you wrt new semantics and I would love to see a practical programming language that has dependent types.
Python, Perl, PHP, and TCL? Not really that innovative....
See: Apple opting for ARC over mark-and-sweep GC.
Links:
http://www.quora.com/How-does-garbage-collection-in-Python-w...
Lua and Squirrel being so close, it makes little practical sense to use Squirrel in a new project. Maybe for fun projects.
(And for something that's a little different, I recommend a look at https://github.com/aardappel/lobster - it's a breath of fresh air among scripting languages; practically, I still recommend Lua over anything else)
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?
In an earlier life I worked on an object-oriented operating system based around reference counting, called intent (you won't have heard of it), and it was horrible. One of the major issues with refcounting is that when you dereference an object, it may be freed then and there... which dereferences any dependent objects... which may be freed... which dereference more objects, etc. So any time you dereference your object, you may end up doing an arbitrary amount of work, which isn't good for real-time performance.
You can usually avoid this by being sensible about when you reference and dereference objects, but now you're effectively doing manual memory management, which slightly defeats the whole point of the exercise.
In our case, we also cocked things up with poor design --- we ended up reffing and dereffing objects a lot, which meant we constantly ran into issues where we needed to deref an object with a lock held, which isn't a good idea. A better designed system wouldn't have done this. Objective C's memory pools work very well: whenever you create an object it gets added to a list, and all objects on the list are dereffed when your app exits to the event loop; so not only do you only need to manually ref objects if you want to keep them until the next event, which is much easier to code for, but the object free overhead all happens at a well-defined point which is usually app idle time.
So while reference counting can help, it still doesn't make the problem go away, and when you're using it you have to remember that you are using it and ensure that your app is designed to cope.
(It's also worth remembering that modern incremental garbage collectors solve the same problem in a different way, and without some of refcounting's problems.)
That is why python will occasionally run a mark and sweep GC even though it says it uses reference counting.
Circular references aren't easy to avoid, sometimes there can be more than 3 levels of indirection. The mental overhead of preventing circular references is often times as high as manually managing memory yourself.
If it was as good as you suggest, every new language would be using reference counting and not occasionally run mark and sweep.
"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.
In my experience, a game script most often uses handles to certain types of game engine objects (cameras, vehicles, characters, the player...) and although it's often necessary to define your own types/classes/objects they're rarely complex. Usually you're just iterating over collections of stuff, exploring trees, querying the current state of the game engine or dealing with some kind of internal state.
Because of this, explicit type safety isn't really the burden it can be in other use cases, even for prototyping. Because you generally want hot reloads and for a game script to fail gracefully without stopping the engine, you probably want to add as much sanity checking as possible before it gets to that point.
There are some nice features added, but I think that some of them are also covered by newer JS versions. I really don't want to argue to much about JS, but other persons will ask the same question, I guess.
The line "optional 16bits characters strings" also makes me worry a little, since I know how much trouble an alternate approach (8bit strings vs. Unicode) there is in Python (which led to major changes in Python 3). It just makes to much headaches.
If the author is reading here, you might also consider linking to a page of your personal website, that is accessible (I get directory listing denied).
Especially since the other option isn't 32 bits, like it was in Python versions before 3.3 (which implemented PEP 393: "Flexible String Representation"). So you can only choose between broken Unicode (no characters outside the basic multilingual plane) or no Unicode at all.
a = "10"/s
Not everybody likes OTB though, honestly.