
The Squirrel Programming Language - cia48621793
http://www.squirrel-lang.org/
======
iumtuip2001
I appear to be a dying breed. A young ( < 30 years old ) programmer, self
taught, who loves classic, "mainstream" languages like C, C++, Java...

Why?

Types.

I cannot stand the road that new languages are on, abandoning the type system,
or making it optional, or not explicit. Given that I appear to be a minority,
I thank you for reading my rant... Have a good day :(

~~~
vog
Note that _proper_ typesystems are not yet mainstream, though.

You should certainly have a look at "less mainstream" languages whose type
systems are more expressive and still simpler to use than those of the
"mainstream" languages. For example (list is incomplete, but you'll get the
idea):

    
    
        * Haskell (very popular, hard to reason about performance, though)
        * OCaml (possible to reason about performance, except for garbage collection)
        * Idris (type system with dependent types!)
        * Rust (type system that allows to reason about memory usage, aliasing, etc.)
        * Elm (meant to replace JavaScript for user interfaces in the browser)

~~~
rtpg
I would add Purescript to that list. Most people see it as a Haskell-like for
the JS VM, but it also includes row types. Meaning that your types can keep
track of granular effects ("oh, this uses IO, but just the random number
generator", "Oh this just looks at the foo property"), which is super useful
for reasoning with larger codebases.

~~~
lomnakkus
Agreed. Purescript[1] is definitely interesting as one the very few languages
in the world with row types/polymorphism.

I'm not quite agreed on the effects bit being useful, but it's a good demo of
what the type system can do. My main disagreement with the whole approach is
that effects don't commute (in general) and so representing effects as such
isn't quite valid.

[1] I'm still baffled as to why they named it thusly. I mean, I can _guess_ at
motivations, but it really deserves a much catchier name!

------
mingodad
I did a fork of Squirrel -> SquiLu
[https://github.com/mingodad/squilu](https://github.com/mingodad/squilu)
because I found the syntax more familiar and also been made with C++ that make
create extensions easier than plain C. Then I started adding more and more
C/C++ like syntax options with the idea to have a way to develop fast
prototypes in a way that could be migrated to C/C++ when performance was not
good enough, the idea is to be able to parse and accept C/C++ syntax but
without actually inforce it at scripting level (accept discard/warning) and be
able to use a real C++ compiler to do the heavy work.

Example:

    
    
        class Klass
        //struct Klass
        {
        	int_t i;
        	//constructor()
        	Klass()
        	{
        		print("Klass constructor", i);
        	}
        	~Klass()
        	{
        		print("Klass destructor");
        	}
        }
        
        Klass k = new Klass();
        
        typedef int_t int;
        
        int test10(int x)
        {
        dente:
        	if(x > 10)
        	{
        		goto dente;
        		goto done;
        		return true;
        	}
        done:
        	return false;
        }
        
        print(test10(23));
        
        output:
        
        test-class-constructor.nut:22:6 warning labels are only parsed right now
        test-class-constructor.nut:25:7 warning goto is only parsed right now
        test-class-constructor.nut:26:7 warning goto is only parsed right now
        test-class-constructor.nut:29:5 warning labels are only parsed right now
        Klass constructor	(null : 0x(nil))
        true

~~~
mingodad
But now Haxe [http://haxe.org/](http://haxe.org/) has several advantages
that's worth consider.

~~~
mingodad
Also worth look at Skew [http://skew-lang.org/](http://skew-lang.org/)

------
dang
Previously discussed at
[https://news.ycombinator.com/item?id=9368075](https://news.ycombinator.com/item?id=9368075).

------
panic
How does this compare to Lua? It seems to be going after a very similar
market.

~~~
adamnemecek
This seems to be making some good points but I'm only reading it now

[https://computerscomputing.wordpress.com/2013/02/18/lua-
and-...](https://computerscomputing.wordpress.com/2013/02/18/lua-and-squirrel-
the-case-for-squirrel/)

Huh, it actually seems like an older language, it's been around for a while
and it's used in some major studio games.

~~~
pikachu_is_cool
To me, it looks like the only improvement of Squirrel upon Lua is automatic
reference counting. Everything else seems like a step backwards.

* C++ < ANSI C

* two null types < one nil type

* separate types for arrays and dicts < tables

* C syntax < plain english

* Builtin classes < make-your-own classes

That's just my opinion though :)

~~~
jwdunne
How is separate types for arrays and dictionaries worse? They are two
different data structures with different uses so should be separate.

~~~
pikachu_is_cool
One of the strengths of Lua is how usable it is for non-programmers. Having
separate concepts for (essentially) a hashmap for integers and a hashmap for
everything else makes it more complicated.

------
ciroduran
OpenTTD ([http://www.openttd.org/en/](http://www.openttd.org/en/)) is a
Transport Tycoon clone that allows you to write an AI player for the game. The
AI player is written in Squirrel.

------
jclekberg
[http://www.ticalc.org/archives/news/articles/14/148/148909.h...](http://www.ticalc.org/archives/news/articles/14/148/148909.html)

------
dalbin
This language is used in Electric Imp, an "IoT" oriented ARM μController with
WiFi, used in Wink products and Lockitron :
[https://electricimp.com/docs/squirrel/squirrelcrib/](https://electricimp.com/docs/squirrel/squirrelcrib/)

------
neukoelln
I think Ron Gilbert uses Squirrel in his upcoming game Thimbleweed Park.

~~~
potomak
Correct, see
[https://blog.thimbleweedpark.com/engine](https://blog.thimbleweedpark.com/engine)
and
[https://blog.thimbleweedpark.com/scripting_test](https://blog.thimbleweedpark.com/scripting_test).

------
kkirsche
How does this compare to Lua which seems to be the go to scripting ish
language in games like world of Warcraft

------
pesha
I had to do one project in Squirrel when I was in university and I have to say
the experience was terrible.

~~~
qz_
Why?

~~~
pikachu_is_cool
Yeah I would also like to know this.

