Why Squirrel Programming?

I just received my IMP kit. It is cool. But I have to ask why in the world did the developers choose Squirrel over the good old c/c++ ?
I can see for some great things to be made with it, but am seriously wondering if the time to learn Squirrel will be worth it.

I’m in the same boat as you, in regards to learning Squirrel. But there are many imp sample scripts and more examples appearing all the time. The only Squirrel support I can find, pertaining to the Imp, is here. But the support here is fantastic.

The tipping point for me is the low cost of the imp, the ease of WiFi connection, not having to connect my PC to make program changes and automatic firmware updates.

I have had concerns about depending on a “cloud” outside of my control, and the possibility of paying a subscription fee for that in the future.

I bought an Imp, and April board, a wall-wart USB power supply, a plastic box, some switches, a relay and some wire … spent about $75 in all, and within a day I was opening and closing my garage door with my smartphone. I can query the status of the door and control it from anywhere in the world. I could not have done that so cheap and quickly without the Imp. I know that for sure.

I agree it is easy to do things, but it would be allot better if I could just re-use allot of my code rather than converting much of it. I was just curious why they chose Squirrel over C.

So, a compiled language was pretty much out simply because we want OS/app isolation. We need something we can wrap up (both on the device and in the server) so that it can be contained if it misbehaves, even on processors with no memory protection.

Hence, a scripting language was needed. We did actually use Lua at one point, but the syntax was just too freaky for C programmers like me so we switched to squirrel.

This allows people to push bad software and not need to rely on a watchdog to hopefully catch it (this has saved commercial customers as well as developers in the past). It also allows us to host many many server side VMs in a safe and contained fashion, which enables the low cost point of the commercial service.

The other reasons include actually wanting a different language - though a fairly familiar one - to prevent people pulling in reams of unsuitable code from other platforms. The event-driven paradigm is not commonly used in other embedded systems, and as such drivers (etc) from them work badly - and inefficiently - on an imp. You need to think a bit as to what you’re doing, and impOS will actively help you do things efficiently.

There are also a LOT of javascript programmers who take to squirrel way better, as they are already used to more modern programming styles than the average C programmer.

I came to Squirrel from Objective-C (Mac OS X, iOS) and it really wasn’t a big shift. Learning Perl and Python were harder because of their very different structures.

BTW, we have a doc which may help: Porting Arduino Code to the imp, which covers how to adapt C++ code to Squirrel, which is 90% removing variable types because Squirrel does this for you.