Live data from Hacker News

The Squirrel Programming Language

developer.valvesoftware.com

41–50 of 51 posts

Re: The Squirrel Programming Language

#41

Earlier quoted context omitted.

AngelScript too: http://www.angelcode.com/angelscript/

Also Lily https://github.com/jesserayadkins/lily recently discussed https://news.ycombinator.com/item?id=12015158

Lily 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 ;)

Re: The Squirrel Programming Language

#42
Ron 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

Re: The Squirrel Programming Language

#44
post #28

Earlier quoted context omitted.

Presumably 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…

If 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. (Las…

Interesting that hajile and you both dislike global-by-default, but your proposed alternatives are essentially opposites. hajile would prefer local-by-default and fewer declarations, and you would prefer nothing-by-default and more declarations...

Re: The Squirrel Programming Language

#46

Ron 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

I 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.

Re: The Squirrel Programming Language

#47
post #28

Earlier quoted context omitted.

Presumably 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…

If 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. (Las…

Lua's metatables are very powerful, and there's actually a tiny implementation of "strict mode" for Lua [1]. I do agree that static checks like these would help the language for serious applications. I recently got back into Lua a bit and the first error I made was omitting "local".

[1]: http://metalua.luaforge.net/src/lib/strict.lua.html

Re: The Squirrel Programming Language

#48

Please 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.

You 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.

Actually, 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.

Re: The Squirrel Programming Language

#49
post #21

Earlier quoted context omitted.

0-index. I tried to like Lua, but indexing from 1 is just too painful when you have to talk to C.

In 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.

No, it's not. See here: http://lua-users.org/wiki/CountingFromOne

I made a comment on that wiki MOONS ago, and it still holds.

Re: The Squirrel Programming Language

#50

Earlier quoted context omitted.

It'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.

Is it actually faster though? https://github.com/r-lyeh/scriptorium Perhaps these results are due to poor coding practices in the example code.

Huh. Weird. That shouldn't be right. Squirrel can do a lot of optimizations Lua can't. Maybe it's just that problem...
Post reply on HN