Live data from Hacker News

The Squirrel Programming Language

developer.valvesoftware.com

21–30 of 51 posts

Re: The Squirrel Programming Language

#21
post #2

Given 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?

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

Re: The Squirrel Programming Language

#22

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.

What does it mean by a language can be multiplexed trivially?

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

Re: The Squirrel Programming Language

#23

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.

What does it mean by a language can be multiplexed trivially?

It really speaks more to the runtime than the language. There's nothing fundamentally anti-parallel about lua, but even just concurrent GC is difficult to execute well. Look at how big of a deal Go's recent low latency claims are.

Re: The Squirrel Programming Language

#24

Official site: http://squirrel-lang.org/ Similar: http://wren.io/index.html

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

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

Re: The Squirrel Programming Language

#25

Earlier quoted context omitted.

What does it mean by a language can be multiplexed trivially?

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

Is that what 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.

Re: The Squirrel Programming Language

#26
post #15

If you're changing the syntax, why not take the time to fix having to use `local` everywhere instead of making things local by default?

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 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 [2] http://lua-users.org/lists/lua-l/2006-10/msg00063.html

Re: The Squirrel Programming Language

#28
post #15

If you're changing the syntax, why not take the time to fix having to use `local` everywhere instead of making things local by default?

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.

(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.)

Re: The Squirrel Programming Language

#29
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…

I 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

Re: The Squirrel Programming Language

#30

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's design is actually pretty unique; it feels a lot less "me too!" than the others.
Post reply on HN