5 ms·
Squirrel Programming Language
- justusw 10y agoGiven that Lua and Squirrel are quite similar due to meta tables resembling each other, what does Squirrel provide compared to Lua except for the C-Style syntax?
- SamReidHughes 10y agoIt looks like arrays are different from tables and they start at 0.
- gyoza 10y agoI am guessing that it is used in Valve games..
- xufi 10y agoI wonder if parts of it were used in TF2 updates since that hasn't gotten an update in a while
- mwcampbell 10y agoThe combination of reference counting and tracing GC looks interesting. There have been a couple of attempts to retrofit reference counting into Lua, but nothing stable or widely used AFAIK.
- qwertyuiop924 10y agoIt's hyper-optimized, small, and can be multithreaded or multiplexed trivially, but that's true of lua as well. The array thing gives it a leg up in speed as well, as does 0-indexing. Finally, its gc algorithm doesn't have cpu bursts (it's not "stop the world"). I don't know of Lua has this feature, but it makes the language ideal for real-time applications. Like games.
- theseoafs 10y agoLua can't be multithreaded in any real sense (by "real", I mean "OS threads"). If Squirrel can that's a big advantage.
- qwertyuiop924 10y agoI thought it could, but I think I might have been wrong... Nope, just coroutines. Sorry for being wrong. However, as it is small and embeddable, it's trivial to spin up multiple instances of the interpreter. But Lua and TCL are just as good at that.
- iamcreasy 10y agoWhat does it mean by a language can be multiplexed trivially?
- qwertyuiop924 10y agoYou can run multiple interpreters, embedded in the same application, in separate threads: multiplexing, as you have multiple instances, as opposed to multithreading, where you have a single instance.
- safewayclubcard 10y agoIs that what https://github.com/rvirding/luerl https://github.com/rvirding/luerl is doing in the erlang VM? From the docs: > It should give you a Lua environment that allows you to effortlessly run tens of thousands of Lua processes in parallel, leveraging the famed microprocesses implementation of the Erlang VM. The empty Luerl State footprint will be yet smaller than the C Lua State footprint.
- qwertyuiop924 10y agoYes. Lua does it quite well by default. Apparently, luerl aspires to do it better.
- 10y ago
- bsder 10y ago0-index. I tried to like Lua, but indexing from 1 is just too painful when you have to talk to C.
- GadgetJax 10y agoIn times like that, I would just assume the array size is +1, and ignore the first C Zero position. It's a pain but just setup something once and its done.
- bsder 10y agoNo, it's not. See here: http://lua-users.org/wiki/CountingFromOne http://lua-users.org/wiki/CountingFromOne I made a comment on that wiki MOONS ago, and it still holds.
- petra 10y agoI think squirrel offers much better C++ integration.
- jonathonf 10y agoOfficial site: http://squirrel-lang.org/ http://squirrel-lang.org/ Similar: http://wren.io/index.html http://wren.io/index.html
- vmorgulis 10y agoAngelScript too: http://www.angelcode.com/angelscript/ http://www.angelcode.com/angelscript/
- mlinksva 10y agoAlso Lily https://github.com/jesserayadkins/lily https://github.com/jesserayadkins/lily recently discussed https://news.ycombinator.com/item?id=12015158 https://news.ycombinator.com/item?id=12015158
- technomancy 10y agoLily's design is actually pretty unique; it feels a lot less "me too!" than the others.
- girvo 10y agoLily is fascinating to me, in that it's the exact language I've been working on in my spare time. Same impetus, use-cases, everything. Guess someone else shares my delusion after all ;)
- brianobush 10y agoBetter to see the actual documentation at: http://squirrel-lang.org/squirreldoc/reference/index.html http://squirrel-lang.org/squirreldoc/reference/index.html
- mcphage 10y agoThe 2008 WiiWare game "Final Fantasy Crystal Chronicles: My Life as a King" was implemented in Squirrel.
- sreidnw 10y agoI've also run across Squirrel (or a variant of it) on Electric Imp (an IoT/embedded platform): https://electricimp.com/docs/squirrel/ https://electricimp.com/docs/squirrel/
- dkersten 10y agoI've played with Squirrel years ago and its a really nice language. But in the end, I went back to Lua because of LuaJIT.
- vegabook 10y agoPlease could you explain to me, if Squirrel is "similar to Lua, but uses a C like syntax", why I wouldn't want to use C or Lua instead? Is this about Steam? If not, is this (even) faster than Lua? Is it easier or safer than C? Am I missing something? You better have something seriously good to offer if in your first breath you're pitching yourself alongside the very best of both interpreted and compiled languages.
- Jtsummers 10y agoYou would use this in the same arena you'd use Lua, not where you'd use C. That is, you want something more flexible than compiled C for your particular application. Why you'd use it over Lua, I haven't figured out yet, but I don't use either so I have no basis for comparison.
- je42 10y agoActually, there are arena's where C is replaced by Lua (with LuaJIT) see OpenResty / Nginx with Lua. Where the normally C plugins to nginx are implemented with lua.
- technomancy 10y agoFrom the wiki (http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/Lua%20Compared%20to%20Squirrel.html http://wiki.squirrel-lang.org/default.aspx/SquirrelWiki/Lua%...) it looks like most of the reasons Squirrel was created stemmed from problems that have since been fixed in Lua. The remaining differences seem pretty minor; IMO having the OO system baked into the language instead of implemented in user-space is a step backwards. The 0-indexing might be nice if you do a lot of FFI with C, I suppose. Hardly worth giving up the insane performance of LuaJIT for though.
- hajile 10y agoIf you're changing the syntax, why not take the time to fix having to use `local` everywhere instead of making things local by default?
- bakery2k 10y agoPresumably the author of Squirrel agrees with (one of) the authors of Lua: "Local by default is wrong" [1]. "The problem is that without local declarations, you cannot say where the variable is local to" [2]. Take Python, for example, where "local by default" means "local to the current function". Variables are created in the current function's scope on assignment, which causes 2 problems: 1. It is awkward to modify variables in outer scopes, because an attempt to assign to them creates a new variable. Python works around this with the `global` and `nonlocal` keywords. 2. Python does not support variables which are local to the current block, for example, the body of a loop. [1] http://lua-users.org/lists/lua-l/2006-10/msg00056.html http://lua-users.org/lists/lua-l/2006-10/msg00056.html [2] http://lua-users.org/lists/lua-l/2006-10/msg00063.html http://lua-users.org/lists/lua-l/2006-10/msg00063.html
- to3m 10y agoIf Lua did the decent thing and insisted that you declare every variable first, it wouldn't have this stupid problem. Squirrel should probably do it, too. Python certainly should! (Even Javascript, misguided as it is in so many respects, has strict mode!) This sort of static checking massively increases the amount of code you can look after without going insane. Add static types too, and you're even better off. (Last time I used Lua, I modified it so that all variables had to be introduced before their first use, either using `local', or a new `global' keyword. More static checks, and no more accidental globals.)
- technomancy 10y agoI would love to have something like Dialyzer to do static checks for Lua, but luacheck is a lot better than nothing: https://github.com/mpeterv/luacheck https://github.com/mpeterv/luacheck
- 10y ago
- snarfy 10y agoIt's also the scripting language for the Irrlicht rendering engine. http://irrlicht.sourceforge.net/ http://irrlicht.sourceforge.net/ (seems down at the moment)
- hoodoof 10y agoNew programming languages need really compelling, upfront "why this new language" arguments. I love the idea of new languages but there's plenty of good ones out there so there has to be a super good argument in my face explaining why.
- grimmdude 10y agoWhy is it called Squirrel?
- GadgetJax 10y agoSquir-Rel who came from Superman's planet, you know.
- habosa 10y agoI interviewed a candidate a year ago who said their preferred language was 'Squirrel'. This was my first interview ever I thought maybe I was being pranked. Was pretty straightforward to read though.
- jupiter90000 10y agoRon Gilbert is using Squirrel as a scripting language in the game Thimbleweed Park [1]. For someone developing games for as long as he has, I think it lends some credibility to it (though I would still evaluate it before I choose to use it for my use cases). [1] https://blog.thimbleweedpark.com/text_tron_3000 https://blog.thimbleweedpark.com/text_tron_3000
- insomniatic 10y agoI really appreciate his examples. I feel like it's a great example of experience seeing the value of a first-order iteration process, but making sure that the technical debt accrued is easily remedied by an automated process that has already been worked out. TLDR: the value of the speed obtained in accruing technical debt, and the wisdom to ensure that you don't have to really pay for it.
- ricksplat 10y agoDoes anybody remember Quake C?